7
A
回答
0
5
对此没有快速解决方案。标准搜索和高级搜索使用两种不同的方法进行搜索。
如果您比较catalogsearch.xml
中的布局,您会发现对于catalogsearch_advanced_result
,块catalogsearch/layer
不包括在内。如果从catalogsearch_result_index
复制块定义并将根模板更改为3columns.phtml
,则会引发各种错误。 >配置 - - >目录 - >目录搜索 -
1
在我的1.6.2分层资产净值为0(零)设置为
系统后,出现了>应用分层导航,如果搜索结果小于
0
简单catalogsearch.xml
预先搜索结果左区域帮助我在我的EE网站上看到它,但我没有检查它在CE版本。
<block type="catalogsearch/layer" name="catalogsearch.leftnav" before="-" template="catalog/layer/view.phtml"/>
所以我完全左侧区域看起来像这样提前上搜索区域的xml文件:
<reference name="left">
<block type="catalog/navigation" name="hello.leftnav" as="hello.leftnav" template="catalog/navigation/hello_left_nav-search.phtml" />
<block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml"/>
</reference>
希望它可以帮助别人。
7
下面的补丁将在高级搜索结果中显示分层导航,并且可以在分层导航中正常工作。 分层导航和搜索结果基于两个独立的产品集合进行显示,其中一个由catalogsearch/Model/Layer.php创建,另一个由catalogsearch/Model/Advanced.php创建。 因此,我们需要覆盖这些模型的几个功能,以使高级搜索中的分层导航工作。
1-在您的local.xml下的catalogsearch_advanced_result标签添加。 catalogsearch /模型/ Layer.php与
public function prepareProductCollection($collection){
if(Mage::helper('catalogsearch')->getQuery()->getQueryText())//for normal search we get the value from query string q=searchtext
return parent::prepareProductCollection($collection);
else{
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
/**
* make sure you cross check the $_REQUEST with $attributes
*/
$attributes = Mage::getSingleton('catalog/product')->getAttributes();
Mage::log(print_r($_REQUEST,1));
foreach($attributes as $attribute){
$attribute_code = $attribute->getAttributeCode();
//Mage::log("--->>". $attribute_code);
if($attribute_code == "price")//since i am not using price attribute
continue;
if (empty($_REQUEST[$attribute_code])){
//Mage::log("nothing found--> $attribute_code");
continue;
}
if(!empty($_REQUEST[$attribute_code]) && is_array($_REQUEST[$attribute_code]))
$collection->addAttributeToFilter($attribute_code, array('in' => $_REQUEST[$attribute_code]));
else
if(!empty($_REQUEST[$attribute_code]))
$collection->addAttributeToFilter($attribute_code, array('like' => "%" . $_REQUEST[$attribute_code] . "%"));
}
$collection->setStore(Mage::app()->getStore())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite();
//Mage::log($collection->getSelect()->__toString());
Mage::getSingleton('catalogsearch/advanced')->prepareProductCollection($collection);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
}
return $this;
}
覆盖getProductCollection
<reference name="left">
<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
覆盖prepareProductCollection功能,具有catalogsearch /模型/ Advanced.php的getSearchCriterias功能
public function getProductCollection(){
if (is_null($this->_productCollection)) {
$this->_productCollection = Mage::getResourceModel('catalogsearch/advanced_collection')
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addMinimalPrice()
->addStoreFilter();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_productCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_productCollection);
if(isset($_GET['cat']) && is_numeric($_GET['cat']))
$this->_productCollection->addCategoryFilter(Mage::getModel('catalog/category')->load($_GET['cat']),true);
}
return $this->_productCollection;
}
public function getSearchCriterias()
{
$search = parent::getSearchCriterias();
/* display category filtering criteria */
if(isset($_GET['cat']) && is_numeric($_GET['cat'])) {
$category = Mage::getModel('catalog/category')->load($_GET['cat']);
$search[] = array('name'=>'Category','value'=>$category->getName());
}
return $search;
}
相关问题
- 1. 将分层导航添加到自定义主题(magento)
- 2. Magento Store - 将nofollow添加到分层导航
- 3. magento高级搜索
- 4. Magento - 检索分层导航属性ID
- 5. 将过滤分层导航添加到1列分类Magento中的页面
- 6. Magento的分层导航和搜索引擎优化
- 7. 如何将搜索栏添加到Xamarin IDE的导航栏中
- 8. Magento分层导航错误
- 9. Magento分层导航颜色
- 10. Magento分层导航类别
- 11. 移动高级搜索 - Magento
- 12. 将航点添加到A *图搜索
- 13. 如何将高级选项添加到Magento产品页面?
- 14. Magento中的分层导航分类
- 15. 如何将活动类添加到magento中的导航链接?
- 16. JqGrid将按钮添加到高级搜索对话框
- 17. 高级搜索导航到网站内部
- 18. 导轨 - 高级搜索
- 19. 如何发送参数到Magento的高级搜索?
- 20. 添加高级搜索数据
- 21. 将向下滑动的搜索框添加到导航菜单
- 22. Magento:显示分层导航中的同级类别
- 23. 在导航栏下添加搜索栏?
- 24. Magento分层导航 - 排序依据数
- 25. 在magento中启用分层导航
- 26. Magento布局和分层导航
- 27. Magento分层导航属性问题
- 28. Magento错误与分层导航
- 29. 在Magento中调整分层导航
- 30. Magento分层导航 - 复选框
你可以检查这个帖子: http://stackoverflow.com/questions/13248461/magento-layered-navigation-on-advanced-search-results/15128386#15128386 – ANKIT