Post by gplus2k » Wed Nov 03, 2010 5:09 pm

Hi folk,

I have a problem on the OpenCart discount feature.

The shop was configured with 2 currency. USD (Primary Currency) and NZD. And I also configured a 10% off discount coupon code for some customers.

Here is the problem: when they check-out in NZD. OpenCart was calculated the total amount correctly. But when the data passed to PayPal. The discount amount was wrong and the total amount was calculated incorrectly.
opencart.jpg

opencart.jpg (42.36 KiB) Viewed 4920 times

paypal.jpg

paypal.jpg (32.78 KiB) Viewed 4920 times

Is there any fix for this? Or is it a possible a bug?
I also attached some images to illustrated the problem.

Thanks!
Last edited by i2Paq on Fri Nov 05, 2010 12:32 am, edited 1 time in total.
Reason: Topic moved

Newbie

Posts

Joined
Mon Nov 01, 2010 12:20 am

Post by Qphoria » Wed Nov 03, 2010 8:09 pm

Version of opencart?
Can we see a link to your site?

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by gplus2k » Wed Nov 03, 2010 11:56 pm

I am using 1.4.9.1 and basically I didn't modify anything related to the PayPal / Payment Gateway settings.
I don't want to public my site here but I have PM you the URL for reference. Thanks!

Newbie

Posts

Joined
Mon Nov 01, 2010 12:20 am

Post by micronuta » Sun Nov 07, 2010 5:40 pm

I am experiencing the same issue.

Running 1.4.9.2

When you add items to cart, then checkout the totals are correct.
When you add a coupon, the discount is applied
when you confirm order and it flips you out to paypal, the items appear and the prices are there, but the disount is nowhere to be seen and the order total is as it was in opencart but without the discount applied.

opencart store is http://www.wozwaste.com/store

Newbie

Posts

Joined
Sun Nov 07, 2010 5:36 pm

Post by Qphoria » Mon Nov 08, 2010 12:48 pm

pm me a coupon code to test with

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by gplus2k » Wed Nov 10, 2010 1:39 pm

Is there any fix or update on this issue? Because the problem still exist and affecting customers......

And PayPal support team already reply me it is a problem on the variable "discount_amount_cart", here is the extract from the email.
The discount amount that displayed on the PayPal payment pages is passed to PayPal in variable "discount_amount_cart". You will need to contact your shopping cart provider if the amount passed to PayPal is incorrect. PayPal only process the amounts that are passed to it from the shopping cart.
Anyone can help? And inputs are welcome! Thanks.

Newbie

Posts

Joined
Mon Nov 01, 2010 12:20 am

Post by JLeuty » Wed Nov 10, 2010 9:16 pm

Not sure if this helps in tracking this down, but I found something interesting on my cart. For testing I set up a $12 coupon on a $12 item and then went into paypal. It was fine in the cart and had my total as just the shipping charge but it did not take the discount off on the paypal screen.

Then I tested with more than 1 item in the cart and a higher priced item and the discount carried through correctly.

I understand that my situation would be weird in giving a full value discount, but maybe it can help you discover something.
I am on version 1.4.9.1
I am running US Dollars only

Newbie

Posts

Joined
Mon Nov 08, 2010 10:13 am

Post by Qphoria » Wed Nov 10, 2010 10:56 pm

Ok there are actually a lot of factors in play here.....

1. Paypal has a "limitation" noted by me here yesterday and confirmed by the paypal forum mod:
https://www.x.com/thread/47330
Basically it means that if you have a discount greater than the product total (subtotal), the discount just doesn't show up. This means if you have something like:

Code: Select all

Item 1 = 5.00
Item 2 = 1.00
Tax = 4.00
Shipping = 10.00
Discount = -10.00   <---- more than the $6.00 item total 
Total = 10.00
The discount won't work right in paypal since they don't consider the shipping or tax to be discounted fields and 10.00 is greater than the product subtotal of 6.00

It is not likely that paypal will fix this. TBH when using the _cart and upload options, they should just accept passthru values instead of ignoring them, but this is no surprise from paypal. So the only fix I see is that when the discount is greater than subtotal, I will have to make shipping and tax appear as line items, thus adding it to the paypal subtotal and fooling paypal into discounting properly

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Thu Nov 11, 2010 12:22 am

You can read more and get the new version here
http://forum.opencart.com/viewtopic.php ... 20#p111190

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by gplus2k » Thu Nov 11, 2010 1:16 am

Alright, glad the see it is fixed and thanks for the patch!
I'll keep monitor the issue.

Newbie

Posts

Joined
Mon Nov 01, 2010 12:20 am

Post by salaria » Fri Sep 02, 2011 1:53 am

Hi All,

I'm facing same issue and found the problem with code.

Actually existing code is using currency conversion twice on $total which is causing this issue

Code: Select all

$total = $this->currency->format($order_info['total'] - $this->cart->getSubTotal(), $currency, false, false);
and

Code: Select all

$this->data['discount_amount_cart'] -= $this->currency->format($total, $currency, FALSE, FALSE);
in /catalog/controller/payment/pp_standard.php

Fix for this issue:
Just replace

Code: Select all

$this->data['discount_amount_cart'] -= $this->currency->format($total, $currency, FALSE, FALSE);
with

Code: Select all

$this->data['discount_amount_cart'] -= $total;
Thanks and Regards,
Mahesh Salaria

Newbie

Posts

Joined
Wed Aug 31, 2011 2:45 pm
Who is online

Users browsing this forum: No registered users and 2 guests