magento是國外的一個商城了,很多國內的朋友都會使用它了,它的優點是免費,開源并且安全了,下面我們來看看magento 開啟solr 產品列表屬性篩選無效例子。
magento 開啟solr 產品列表屬性篩選無效 ,solr layered navigation 不起作用。比如價格屬性篩選等
一:debug了一段時間,發現solr返回的$this->_searchedEntityIds = &$ids; 被執行兩次,也就double sql,結果是GA造成個collection 復用,產品list頁面調用getLoadedProductCollection
$_productCollection = Mage::getBlockSingleton(“catalog/product_list”)->getLoadedProductCollection();
$_productCollection_clone = clone $_productCollection;
二:double sql問題解決還是篩選無效,發現是layout layered里面為調用serch 類型的模板.
<block type=”enterprise_search/catalog_layer_view” name=”product.attribute.layer” before=”-” template=”catalog/layer/view.phtml”/>
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>responsive/css/productlist.css</name></action>
<action method="addItem"><type>skin_css</type><name>css/jquery.jscrollpane.css</name></action>
<action method="addItem"><type>skin_js</type><name>js/jquery.jscrollpane.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/jquery.mousewheel.js</name></action>
</reference>
<reference name="left_first">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml">
<block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
</block>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="decathlon/catalog_product_list_notify" name="notify.list.box" template="catalog/product/notify_list_box.phtml"/>
<block type="enterprise_search/catalog_layer_view" name="product.attribute.layer" before="-" template="catalog/layer/view.phtml"/>
<block type="core/text_list" name="product_list.name.after" as="name.after" />
<block type="core/text_list" name="product_list.after" as="after" />
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
<!-- Since the addColumnCountLayoutDepend does not work, we are manually setting the max columns -->
<action method="setColumnCount"><count>4</count></action>
</block>
</block>
</reference>