Magento - get a list of bundled product ids from a product id

后端 未结 2 1740
一生所求
一生所求 2020-12-29 14:26

Lets say I load my product object:

$product = Mage::getModel(\'catalog/product\')->load($productId);

Is there a function or some way to

2条回答
  •  清歌不尽
    2020-12-29 14:49

    Try this-

    $collection = $product->getTypeInstance(true)
        ->getSelectionsCollection(
            $product->getTypeInstance(true)
                    ->getOptionsIds($product), $product);
    
    foreach ($collection as $item) {
        # $item->product_id has the product id.
    }
    

提交回复
热议问题