我很难让传呼机按我的意愿在马根托工作。
问题是:
我得到了一个产品集合,在其中,我只过滤产品与图像。
但是分页仍然显示没有过滤的产品总数,如何解决这个问题?
示例:我得到了38种产品,其中只有23种有关联的图像,如果我定义按页面显示9个产品,它应该显示1\2/3,但它仍然显示了1\2-2
预先谢谢,下面是我用来过滤产品的代码。
$_productCollection = clone $this->getLoadedProductCollection()
->clear()
->addAttributeToFilter('small_image', array('neq' => 'no_selection'))
->load();发布于 2016-07-14 03:35:59
也许您需要包括addAttributeToSelect:
$_productCollection = clone $this->getLoadedProductCollection()
->clear()
->addAttributeToSelect('*')
->addAttributeToFilter('image', array('neq' => 'no_selection'));编辑1
好的,您需要进入文件app/code/core/Mage/Catalog/Model/Category.php并尝试从以下位置编辑getProductCollection()方法:
public function getProductCollection()
{
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($this);
return $collection;
}转入:
public function getProductCollection()
{
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addAttributeToFilter('small_image', array('neq' => 'no_selection'))
->addCategoryFilter($this);
return $collection;
}当然,您不应该直接编辑它,然后在您的本地池中重写。而你的克隆代码可以被删除。
https://stackoverflow.com/questions/38365007
复制相似问题