我试图根据与其关联的简单产品的属性显示分组产品列表。现在我在做类似下面简单和分组产品之间的内部连接按简单产品(Magento)的属性筛选
- Create a collection of simple products and add attribute filters like color,brand etc., like below
$productCollection = Mage::getModel('catalog/product')->getCollection()
->addStoreFilter(Mage::app()->getStore())
->addAttributeToFilter($aname,$avalue)
->addAttributeToFilter('type_id', array('eq' => 'simple'))
->addAttributeToFilter(ATTRIBUTE_CODE,ATTRIBUTE_VALUE_ID);
(->addAttributeToFilter('color',5))
- Obtain all resultant ids and get its parent ids using the below
Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($productCollection->getAllIds());
- Read the parent ids from above object and show the result in a custom grid that i created
- Created a paging logic for parent ids and do paging in view file
这个逻辑实在耗费更多的时间,有没有什么办法,我可以做所有这些在一个单一的集合?可能是简单和分组产品之间的内连接方法!
请建议。
感谢, 巴兰