Mar*_*kie 3 anchor children magento
在锚类别页面上,我试图仅显示该类别中直接包含的产品.我不想展示子类别的产品,在这种情况下不合适.我确实需要过滤当前类别中的产品,因此我需要分层导航,这需要一个锚类别.
最初我想过滤view.phtml模板中的产品,但这只是过滤视图中的产品而不是一个明智的答案.当我这样做时,我的页面上存在很大的差距,其中存在儿童产品,但根本没有显示.产品数量(例如"117个产品中的1-12个")是"不正确的".
根据我的阅读,这将需要核心重写.可能是一个索引过程.我真的不知道从哪里开始这个重写,我相信它会涉及到更多.
我的任何假设都是错的吗?你已经解决了这个问题吗?
去 app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php
复制到 app/code/local/Mage/Catalog/Model/Resource/Product/Collection.php
找到功能 addCategoryFilter(,在这里你找到代码
public function addCategoryFilter(Mage_Catalog_Model_Category $category)
{
$this->_productLimitationFilters['category_id'] = $category->getId();
/* start to comment here
if ($category->getIsAnchor()) {
unset($this->_productLimitationFilters['category_is_anchor']);
} else {
$this->_productLimitationFilters['category_is_anchor'] = 1;
}*/
/* new line */
$this->_productLimitationFilters['category_is_anchor'] = 1;
if ($this->getStoreId() == Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID) {
$this->_applyZeroStoreProductLimitations();
} else {
$this->_applyProductLimitations();
}
return $this;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3444 次 |
| 最近记录: |