0

i want to apply custom discount on grand total (without coupons) in create order section in magento admin.

i have added 2 lines code for check in this file app\code\core\Mage\Adminhtml\Block\Sales\Order\Create\Items\Grid.php

in function

public function getSubtotal()
    {


        if ($this->displayTotalsIncludeTax()) {
            if ($address->getSubtotalInclTax()) {

                return $address->getSubtotalInclTax();

            }

            return $address->getSubtotal()+$address->getTaxAmount();
        } else {
             $address->setDiscountAmount(-(400));
     $address->setDiscountDescription('Custom Discount');




     $address->save();
     return $address->getSubtotal();
        }
        return false;
    }

but it is not only applied on subtotal of products not on grand total

see here output of applied code

Need help to find correct function.

3
  • what did u try? Commented Jun 12, 2015 at 10:23
  • @Manashvibirla just added two lines $address->setDiscountAmount(-(400)); $address->setDiscountDescription('Custom Discount'); to check it. but it this $400 discount applied on subtotal only not on grand total . i think there is any other function to calculate grand total .
    – Ashvini K
    Commented Jun 12, 2015 at 10:29
  • @AshviniMarwal Suppose if i want to enter discount price at order page how can i change.. Now your code looks like assigned discount order amount in code. i need change randomly so assigning discount amount in code is not a good idea.
    – zus
    Commented Feb 5, 2018 at 5:41

1 Answer 1

0

I have fixed. issue was in get price with tax.

4
  • can you please add your code here i m also stuck with problem like you.Thanks
    – Zahirabbas
    Commented Mar 25, 2016 at 7:35
  • follow this article excellencemagentoblog.com/blog/2012/01/27/…
    – Ashvini K
    Commented May 16, 2016 at 7:07
  • @Zaheerabbas Could you pls explain how you achieve this.
    – zus
    Commented Feb 5, 2018 at 5:47
  • @Zaheerabbas what issue you are facing ?
    – Ashvini K
    Commented Feb 5, 2018 at 8:26

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.