+91-943-185-6038 me@shashidharkumar.com

magentoI have problem to show the EMI price for particular product in bundled product in Magento. So I have tried to go through the google and found some interesting forum post to get the bundle product’s price.

<?php

$product_id = YOUR_PRODUCT_ID;

$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_prices[]=$option->getPrice();
}

sort($bundled_prices);

$minimum_price=$bundled_prices[0];
$maximum_price_tmp=array_slice($bundled_prices, -1, 1, false);
$maximum_price=$maximum_price_tmp[0];

echo “Minimum Price:” . $minimum_price;
echo “Maximum Price:” . $maximum_price;

?>

See also  Change default sort order ASC to DESC for product listing in Magento