I am currently looking for a way to display multiple discounts in the Magento shopping cart without having to buy an extension. If a customer is purchasing an order over $50 then shipping is free, if they use coupon code "rush13" then they get a 10% discount. The shipping price and discount are both calculating correctly but they are showing up on one line. Is there a way display the discounts broken down? I feel this would be easier on the customer to see how much they are receiving for each discount.
I'm using Magento 1.7
Subtotal: $xxx.xx
Discount (Free Shipping, Applied Coupon Code RUSH13) -$xx.xx
Subtotal: $xxx.xx
Discount(Free Shipping) -$xx.xx
Discount(Coupon Code RUSH13) -$xx.xx
Subtotal: $xxx.xx
Discount(Free Shipping -$xx.xx, Coupon Code RUSH13 -$xx.xx) -$xx.xx
Any help would be appreciated. I don't like posting questions without code here but I'm not sure where to start on this one. Thanks in advance.
class Mage_SalesRule_Model_Validator
is responsible for discount calculation. So we can set our Discount Description from this looped calculation.
in the method
public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
look for the code
$discountAmount = $result->getDiscountAmount();
and place these 2 lines after above code which will prepare our description array in current foreach loop
$_formatedDiscountAmount = Mage::helper('core')->currency($discountAmount, true, false);
$_descriptionArray[] = $rule->getName()."-".$_formatedDiscountAmount;
and at last, right after the end of the foreach place this code
$address->setDiscountDescriptionArray($_descriptionArray);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With