这是我的问题:我有2件颜色为红色和蓝色的衬衫,每件都有尺码S,M,L(共6件商品)这6件商品此产品属于Real-Madrid衬衫
我只需要列出2件红色和蓝色的衬衫(大小无关紧要)
我试图覆盖
_getLoadedProductsCollection()在Mage_Catalog_Block_Product_List中,但它对我不起作用
我必须为这6件衬衫只有一个可配置的产品 . 很遗憾,我不能为每种颜色使用2个可配置的产品
解决方案如下:
1-在Mage_Catalog_Model_Layer中覆盖prepareProductCollection($ collection)
2-准备产品清单后你需要显示
3-使用$ collection - > addAttributeToFilter('entity_id',$ ids
$ collection - > addAttributeToSelect(Mage :: getSingleton('catalog / config') - > getProductAttributes()) - > addMinimalPrice() - > addFinalPrice() - > addTaxPercents() - > addUrlRewrite($ this-> getCurrentCategory() - > getId())//在这里过滤你的产品 - > addAttributeToFilter('entity_id',$ ids);
)
1 回答
解决方案如下:
1-在Mage_Catalog_Model_Layer中覆盖prepareProductCollection($ collection)
2-准备产品清单后你需要显示
3-使用$ collection - > addAttributeToFilter('entity_id',$ ids
)