分层导航使用单独加载的集合对象。
一种可能的方式,以确保未来的导航过滤器正确的计数是覆盖模型Mage_Catalog_Model_Layer
和你的过滤器添加到其功能Mage_Catalog_Model_Layer::prepareProductCollection
public function prepareProductCollection($collection)
{
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addUrlRewrite($this->getCurrentCategory()->getId())
->addAttributeToFilter('type_id', 'simple');
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
return $this;
}
要做到这一点你当地代码库创建一个模块。在3210文件中添加以下节点到节点global
<models>
<catalog>
<rewrite>
<layer>YourPackage_YourModule_Model_Rewrite_Layer</layer>
</rewrite>
</catalog>
</models>
在你的模块添加目录“重写”文件夹下的“样板”,并在其上创建文件Layer.php
。在创建的文件Model/Rewrite/Layer.php
添加一个类,定义如下:
class YourPackage_YourModule_Model_Rewrite_Layer extends Mage_Catalog_Model_Layer {
}
添加功能上面这个类,清除缓存。
为什么这些产品在这个类别中,如果你不想让他们在那里开始? – clockworkgeek
因为当用户在产品页面(可配置)时,我需要完整的面包屑(主页>分类>子菜单>产品) 使用颜色色板模块。我想在类别页面中显示所有简单的产品,并且当用户点击某个产品时,他会转到该简单产品的可配置产品,使用完整面包屑 – Paulo