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