Magento - get a list of product identifiers from a product identifier

Let's say I load my product object:

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

Is there any function or any way to extract the associated identifiers of this product?

eg.

 $product->getBundledProductIDs() 
+8
bundle product magento
source share
2 answers

The following should work:

 $product->getTypeInstance(true)->getChildrenIds($product->getId(), false) 

The result is a multidimensional array with the top level being options, and the children are products.

In addition, you can change the false value to true, and it will return only the desired package parameters.

+21
source share

Try it -

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

All Articles