Question

Recently i came across the issue is When i display price of bundle product on listing page which shows either lowest price or highest price total by making total of all product within a bundle.

As i have set few product to default selected within a group so, on the product view page that default poduct price from perticualar group has been calculated in final total. but on price of product listing page count the minimum amount from the group of product.

So, what happens that customer view the product detail from product listing where it shows the lowest price but, on product view page it shows different price because now it counts default product price instead of minimum price from the group.

I want to display pre-configured product price from view page to product listing page.

Thanks in advance!

Was it helpful?

Solution

// load product
$product = new Mage_Catalog_Model_Product();
$product->load(165);
$priceModel = $product->getPriceModel();

// get options
$block = Mage::getSingleton('core/layout')->createBlock('bundle/catalog_product_view_type_bundle');
$options = $block->setProduct($product)->getOptions();

$price = 0;
foreach ($options as $option) {
  $selection = $option->getDefaultSelection();

  if ($selection === null) {
    continue;
  }

  $price += $priceModel->getSelectionPreFinalPrice($product, $selection, $selection->getSelectionQty());
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top