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

woot586 picture woot586 · Aug 31, 2011 · Viewed 15.2k times · Source

Lets say I load my product object:

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

Is there a function or some way to extract the bundled ids related to this product?

e.g.

$product->getBundledProductIDs()

Answer

Lee Saferite picture Lee Saferite · Aug 31, 2011

The following should work:

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

The result is a multi-dimensional array with the top level being options and the children of options being products.

Also, you can change the false to a true and it will only return required options of the bundle.