1

I have shopping cart promotion rules which gives discount for buying 4 products. This works fine on shopping cart page. I mean it applies discount and shows discounted price in TOTAL row. I want to show customer this discounted price on another page before he adds product to cart. How can I do it? Basically it is calculating price where product id and qty is given applying shopping cart price rules.

2

Try something like code below, it should work correctly for tier prices and catalog price rules.

    /* @var $item Mage_Sales_Model_Quote_Item */
    $item = Mage::getModel('sales/quote_item');
    $qty = 3;
    $product = /* load product you want to get price for */;
    $item->setProduct($product);
    $item->setQty($qty);
    $item->setQuote(/* get quote from checkout session */);
    $finalPrice = $product->getFinalPrice($item->getQty());
    $item->setPrice($finalPrice)
        ->setBaseOriginalPrice($finalPrice);
    $item->calcRowTotal();                

    $item->getRowTotal();

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.