Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / PayPal Express Checkout support / Error: The totals of the cart item amounts do not match order amounts.

Error: The totals of the cart item amounts do not match order amounts.

Locked
This thread is locked. New replies are disabled.
19 May 2008, 2:04 PM
#1
werefish avatar

werefish

New Zenner

Join Date:
Mar 2008
Posts:
2
Plugin Contributions:
0

Post #1 by werefish

Hi,

We have a zen cart installation running; version 1.3.8, and we've been encountering problems with the Paypal Express Checkout module. Today we received an error claiming that 'The totals of the cart item amounts do not match order amounts'.

Checking the log files this is indeed the case:

Array
(
[ITEMAMT] => 81.50
[HANDLINGAMT] => 6.00
[SHIPPINGAMT] => 13.20
[AMT] => 88.70
...

The product in question has a number of attributes but only one affects the price. It is a dropdown list which provides a one-off cost, which in this case was £6.00. The actual ITEMAMT should be 75.50, so an extra £6 has been added here and £6 added as a HANDLINAMT as well. Can anyone help me resolve this please. Thanks for your time.

Loz

19 May 2008, 7:02 PM
#2
werefish avatar

werefish

New Zenner

Join Date:
Mar 2008
Posts:
2
Plugin Contributions:
0

Post #2 by werefish

I think I've identified the problem. At line 1496 we find the code for adding one time charges to the passed amount

// add all one-time charges
$optionsST['ITEMAMT'] += $onetimeSum;

As far as I can tell, in my case, the one time charge has already been included with the overall amount meaning it is being added again. Then when the code reaches line 1512 there is some code which attempts to balance any discrepancy between the item values its recorded and the total amount which has been passed:

// subtotals have to add up to AMT
// Thus, if there is a discrepancy, make adjustment to HANDLINGAMT:
$st = $optionsST['ITEMAMT'] + $optionsST['TAXAMT'] + $optionsST['SHIPPINGAMT'] + $optionsST['HANDLINGAMT'];
if ($st != $optionsST['AMT']) $optionsST['HANDLINGAMT'] += strval($optionsST['AMT'] - $st);

If theses do not add up the difference is passed into HANDLINGAMT which in my case will be -6, which I'm guessing is read as 6 by paypal. Hence my overall differnce od £12.

My solution has been to comment out $optionsST['ITEMAMT'] += $onetimeSum; which works at least for the erroneous transaction in my sandbox account. Does anyone know what problems this could potentially create? Its ugly but I'm thinking any problems here will be caught by the discrepancy code above. Any thoughts?

20 Dec 2010, 8:56 AM
#3
kenik avatar

kenik

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Post #3 by kenik

For me works

// $st = $optionsST['ITEMAMT'] + $optionsST['TAXAMT'] + $optionsST['SHIPPINGAMT'] + $optionsST['HANDLINGAMT'];

$st = $optionsST['ITEMAMT'] + $optionsST['SHIPPINGAMT'] + $optionsST['HANDLINGAMT']; // Do nto count TAX is included in $optionsST['AMT']

if ($st != $optionsST['AMT']) $optionsST['HANDLINGAMT'] += ($optionsST['AMT'] - $st);