Lets s开发者_C百科ay 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()
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.
Try this-
$collection = $product->getTypeInstance(true)
->getSelectionsCollection(
$product->getTypeInstance(true)
->getOptionsIds($product), $product);
foreach ($collection as $item) {
# $item->product_id has the product id.
}
精彩评论