Monday, February 6, 2012

Getting Associated products of bundle products or displaying simple products of bundle products

If you need to get Associated products sku of bundle products use below code


$product_id=7763;
$bundled_product = new Mage_Catalog_Model_Product();
$bundled_product->load($product_id);
$selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
$bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
);

$bundled_items = array();
foreach($selectionCollection as $option)
{
$bundled_items[] = Mage::getModel('catalog/product')->load($option->product_id)->getSku();
}

print_r($bundled_items);

No comments:

Post a Comment