0

I've been working on this for some time with no luck. Basically, what I want to do is change the way bundle pricing works in Magento 1.9 so that, for each of the individual products in a bundle product, it uses the regular price at all times, even when the simple product in the bundle has a special price.

So for example, when I have a bundle that contains a simple product with a regular price of $19.95, I want the dynamic price of the bundle to be calculated using the $19.95 even when I put the simple product on special for $15.00.

I identified getSelectionFinalTotalPrice in Mage_Bundle_Model_Product_Price as the most likely place to change the code, but it seems no matter what I do it always returns the simple product's special price.

This is the code in its unmodified state

public function getSelectionFinalTotalPrice($bundleProduct, $selectionProduct, $bundleQty, $selectionQty,
                                            $multiplyQty = true, $takeTierPrice = true)
{
    if (is_null($selectionQty)) {
        $selectionQty = $selectionProduct->getSelectionQty();
    }

    if ($bundleProduct->getPriceType() == self::PRICE_TYPE_DYNAMIC) {
        $price = $selectionProduct->getFinalPrice($takeTierPrice ? $selectionQty : 1);
    } else {
        if ($selectionProduct->getSelectionPriceType()) { // percent
            $product = clone $bundleProduct;
            $product->setFinalPrice($this->getPrice($product));
            Mage::dispatchEvent(
                'catalog_product_get_final_price',
                array('product' => $product, 'qty' => $bundleQty)
            );
            $price = $product->getData('final_price') * ($selectionProduct->getSelectionPriceValue() / 100);

        } else { // fixed
            $price = $selectionProduct->getSelectionPriceValue();
        }
    }

$price = $this->getLowestPrice($bundleProduct, $price, $bundleQty);

    if ($multiplyQty) {
        $price *= $selectionQty;
    }

    return $price;
}

It all looks fairly straightforward, especially for dynamic bundles - there's really only one price calculation. I tried commenting out the call to getLowestPrice but it still returned the same incorrect values.

I'm hoping someone might be able to help with some advice as to how to go about this, I've been tearing my hair out for weeks over this.

  • its not good practice to change in core file but you want to change then change final_price to price – Gopal Patel Mar 1 '17 at 16:28
  • Oh I never change a core file, always override.Unfortunately, making that change had no effect, the bundles are still using the special price of the individual bundle items rather than the base price. – Daniel Bernsons Mar 2 '17 at 11:10
  • Hi Daniel. Did you find a solution? – Rafael Patro Apr 20 '17 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.