Magento - how do I get associated products of product Group?

后端 未结 3 768
灰色年华
灰色年华 2021-01-31 11:55

I am looping through products results, and if the product is a grouped product, I want to get all products in that group. I\'m doing this:

$products = Mage::getM         


        
3条回答
  •  不思量自难忘°
    2021-01-31 12:51

    To get product collection by type:

    $product = Mage::getModel('catalog/product')
       ->getCollection()
       ->addAttributeToFilter('type_id', array('eq' => 'grouped'))
       ->load();
    
    $parentProductId = array();
    
    foreach($product as $simpleProducts) {
      $simpleProducts->loadParentProductIds();
      array_push($parentProductId,$simpleProducts->getParentProductIds();
    }
    

提交回复
热议问题