1

I need to show round value of discount coupon, like if i have apply 10% discount on cart and after apply if 99.90 value is deducted from subtotal then if need to show 99.90 value round off and then deduct price from subtotal. Is this possible to round off only discount price on cart?

3

2 Answers 2

0

copy these file from core to local folder from app/code/core/Mage/SalesRule/Model/Quote/Discount.php. with same folder structure..

find this function

 public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
        $amount = round($address->getDiscountAmount()); /* round up value */

        if ($amount != 0) {
            $description = $address->getDiscountDescription();
            if (strlen($description)) {
                $title = Mage::helper('sales')->__('Discount (%s)', $description);
            } else {
                $title = Mage::helper('sales')->__('Discount');
            }
            $address->addTotal(array(
                'code'  => $this->getCode(),
                'title' => $title,
                'value' => $amount
            ));
        }
        return $this;
    }

change

 $amount = $address->getDiscountAmount();

to

$amount = round($address->getDiscountAmount());
2
  • This only seems to effect how the discount is displayed. The grand total remains the same, as if it has been calculated using the non-rounded amount.
    – micwallace
    Dec 18, 2017 at 1:48
  • it's round up the discount values only Dec 18, 2017 at 18:37
0

Here you go..

Edit or copy to local folder

app/code/core/Mage/Core/Model/Store.php

public function roundPrice($price)
    {
        return round($price, 0);
    }

Change return round($price, 2); to return round($price, 0);

This resolved my issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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