我試圖根據與其關聯的簡單產品的屬性顯示分組產品列表。現在我在做類似下面簡單和分組產品之間的內部連接按簡單產品(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
這個邏輯實在耗費更多的時間,有沒有什麼辦法,我可以做所有這些在一個單一的集合?可能是簡單和分組產品之間的內連接方法!
請建議。
感謝, 巴蘭