0

I've a problem in the order resume when a user is applying a discount code.

The total amound is wrong

In fact the subtotal is 68 + 8 (shipment) and - 6.80 (discount code) = €69.2 and not €76.0 like what's written in the page.

The payment is made with paypal and the total is correct (€69.2) but magento is putting the order in Subspected Fraud - IPN "Completed". Order is suspended as its capture amount 69,20 € is suspected to be fraudulent.

Actually the problem is happening with any discount code. How can I solve this problem?

6
  • discount code means coupon code or any custom discount programmatically ? Dec 9, 2016 at 6:56
  • Coupon code man, sorry Dec 9, 2016 at 17:33
  • @GopalPatel no ideas? Dec 13, 2016 at 10:42
  • Such issue arise after applying programmatically custom discount. As you have applied coupon then must be you have change core code of coupon or in observer you have change the quote. Dec 13, 2016 at 10:49
  • @GopalPatel the problem is that I've not changed anything in the source code of magento... Dec 13, 2016 at 11:45

3 Answers 3

1
+50

Are you by any chance running this on PHP7?

If so, you might be looking at error due to order in which totals are calculated. If so, please refer to this.

0
0

Check the setting :

Admin->System->Configuration->Sales->Tax->Calculation Setting->Tax Calculation Method Based On

Change this setting as on Total.

Also I think you are not updating grand total and base grand total when applying custom discount programmatically.

You have to update these 2 values when calculating discount.

5
  • "Tax Calculation Method Based On" was already "Total". I don't know where to find the grand total and base grand total options. Otherwise I tried to set "Enable Cross Border Trade" on Yes but it still doesn't change. Dec 14, 2016 at 7:57
  • @GiacomoTorricelli, Please put your discount calculation code in your question, then only I can help you. Dec 14, 2016 at 9:16
  • Actually I'm using the IWD One Page checkout iwdagency.com/extensions/one-step-page-checkout.html Dec 14, 2016 at 9:24
  • @GiacomoTorricelli, IWD is just a checkout process. Its not calculating discount. How you are offering discount on any order ? Dec 14, 2016 at 9:34
  • Yes IWD is the checkout extension but it integrate the discount code textbox in that page so I think it's in their code the coupon management. I'm generating coupons with Shopping Cart Price Rules obv. Dec 14, 2016 at 9:39
0

Try this:-

Replace the following in Mage_Paypal_Model_Hostedpro_Request

protected function _getOrderData(Mage_Sales_Model_Order $order)

     {
                $request = array(
                    'subtotal'      => $this->_formatPrice($order->getBaseSubtotal()),
                    'tax'           => $this->_formatPrice($order->getBaseTaxAmount()),
                    'shipping'      => $this->_formatPrice($order->getBaseShippingAmount()),
                    'invoice'       => $order->getIncrementId(),
                    'address_override' => 'true',
                    'currency_code'    => $order->getBaseCurrencyCode(),
                    'buyer_email'      => $order->getCustomerEmail(),
                    'discount'         => $this->_formatPrice(
                        $order->getBaseGiftCardsAmount()
                        + abs($order->getBaseDiscountAmount())
                        + $order->getBaseCustomerBalanceAmount()
                    ),
                );

with this

protected function _getOrderData(Mage_Sales_Model_Order $order)
    {
        $request = array(
            'subtotal'      => $this->_formatPrice($order->getBaseGrandTotal()),
            'invoice'       => $order->getIncrementId(),
            'address_override' => 'true',
            'currency_code'    => $order->getBaseCurrencyCode(),
            'buyer_email'      => $order->getCustomerEmail(),
            ),
        );

Your Answer

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

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