我已經創建了自定義塊以從多個類別中檢索產品。我已經將此塊擴展到核心產品列表塊。尋呼機不工作的自定義集合,有任何想法爲什麼分頁不工作? 我在collection.php使用此功能在magento中定製集合的分頁問題
public function addCategoriesFilter($categories)
{
$alias = 'cat_index';
$categoryCondition = $this->getConnection()->quoteInto(
$alias.'.product_id=e.entity_id AND '.$alias.'.store_id=? AND ',
$this->getStoreId()
);
$categoryCondition.= $alias.'.category_id IN ('.$categories.')';
$this->getSelect()->group('e.entity_id');
$this->getSelect()->joinInner(
array($alias => $this->getTable('catalog/category_product_index')),
$categoryCondition,
array('position'=>'position')
);
$this->_categoryIndexJoined = true;
$this->_joinFields['position'] = array('table'=>$alias, 'field'=>'position');
return $this;
}
我假設你正在談論Mage_Catalog_Block_Product_List。您擴展並可能覆蓋_getProductCollection()。但是你在哪裏在這裏添加了$ yourCollection-> addCategoriesFilter()?你能展示這段代碼嗎? – Zyava