Magento: Get minimal and maximal price of bundle product

Tweet about this on TwitterShare on LinkedInShare on Google+Share on FacebookEmail this to someone

During last 2 weeks I worked a lot with bundle products. My task was to get the maximal and minimal prices of bundle product. I used those prices in order to create meta data for schema.org – AggregateOffer. I had to find a way how to get the maximal and minimal price of bundle product. Below you will find a snippet that provides a solution. The snippet was taken from “app/design/frontend/base/default/template/bundle/catalog/product/price.phtml” in Magento CE 1.9 .

/**
 * @var $_priceModel Mage_Bundle_Model_Product_Price
 */
$_priceModel  = $_product->getPriceModel();

list($_minimalPriceTax, $_maximalPriceTax) = $_priceModel->getTotalPrices($_product, null, null, false);
list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false);

// Debug info
var_dump($_minimalPriceTax); //float(104.4)
var_dump($_maximalPriceTax); //float(104.4)
var_dump($_minimalPriceInclTax); //float(104.4)
var_dump($_maximalPriceInclTax); //float(104.4)

Your thoughts?

Tweet about this on TwitterShare on LinkedInShare on Google+Share on FacebookEmail this to someone

Tsvetan Stoychev

Tsvetan aka. Cecko is the founder of Cecko's Lab. He is Magento addicted since Magento CE 1.2.1.2 and has worked on over 30 Magento projects. At the moment he is in charge to take care about the money flow of the company, to keep constant communication with the clients and to keep the people in the office busy.

More Posts

Follow Me:
TwitterLinkedIn