Question

For a product I have a catalog price rule and tier price.

When I add item to cart Magento always takes the least price. Is there any way to set it to take price according to catalog price rule always?

I searched but didn't get a solution for this. Is there any admin settings for this?

Was it helpful?

Solution

The code that drives the price can be found in Mage_Catalog_Model_Product_Type_Price

public function getFinalPrice($qty=null, $product)
{
    if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
        return $product->getCalculatedFinalPrice();
    }

    $finalPrice = $product->getPrice();
    $finalPrice = $this->_applyTierPrice($product, $qty, $finalPrice);
    $finalPrice = $this->_applySpecialPrice($product, $finalPrice);
    $product->setFinalPrice($finalPrice);

    Mage::dispatchEvent('catalog_product_get_final_price', array('product'=>$product, 'qty' => $qty));

    $finalPrice = $product->getData('final_price');
    $finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);

    return max(0, $finalPrice);
}

In _applyTierPrice

$finalPrice = min($finalPrice, $tierPrice);

and through _applySpecialPrice

$finalPrice     = min($finalPrice, $specialPrice);

There are no options involved and it will return the minimum price.

In my view this also matches the expectation of the customer!

If you do want to change this behaviour you can observe the event catalog_product_get_final_price and use $product->setData('final_price',X.YZ); to the value you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top