Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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()
like image 942
woot586 Avatar asked Aug 31 '11 10:08

woot586


1 Answers

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.

like image 93
Lee Saferite Avatar answered Oct 03 '22 23:10

Lee Saferite