0

is there any module that I can subtract the amount that I want to discount from the order totals?

  1. How to apply discount on order page?
  2. I need to apply discount manually in admin order page.
  • Is solve your issue? – user51361 Jun 8 '17 at 11:33
  • There is a module for this redchamps.com/…. Please note that it is a paid module and it belongs to me. – Ravinder Sep 5 '17 at 13:50
2

I had to do it today...

//Load order with ID
$order = Mage::getModel("sales/order")->load(530);

//or load order with increment ID
$order = Mage::getModel("sales/order")->loadByIncrementId(100000530);

//set an value to your discount
$discount = 10;

//apply to order discount
$order->setBaseDiscountAmount($discount);
$order->setDiscountAmount($discount);

//apply to order grand total
$order->setBaseGrandTotal($order->getBaseGrandTotal() - $discount);
$order->setGrandTotal($order->getGrandTotal() - $discount);

//and finally save your order
$order->save();

If you want to apply discount on shipping you can use:

$order->setBaseShippingDiscountAmount($discount);
$order->setShippingDiscountAmount($discount);

This code is to discount fixed value, but you can adapt this code to give a percentual discount too.

  • how would i give percentage discount when create order in admin only. which table have to save data how would i fetch it to total ? – lalit mohan Dec 10 '16 at 9:07
1

If you need to apply the discount to your order just manually setup the admin side as pricing rule also given expiry date too.Then manually to code the current date and expiry date comparison for discount is present checking by price rule name.After that to take the amount subtracted by sub total of order.Try this.

$rule = Mage::getModel('salesrule/rule')->load('discount','name');
$dis = $rule->getDiscountAmount();
  • Here discount as the rule name. – aash ma Aug 21 '15 at 6:09
-1

Create a discount with the conditions you want and apply it to the order you are creating. This is the easiest way to achieve what you want.

  • I need to apply discount on existing order :( – Brian Kim Jun 10 '15 at 18:34

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.