baps Posted April 23, 2014 Share Posted April 23, 2014 Hi folks, Hit a slight problem with transactions with more than one item quantity. The installation (v2.3.1) this is on has some issues with the tax implementation, but I'm not quite sure what the purpose of the following piece of script is in the paypal express script (ext\modules\payment\paypal\express.php). $nProd = sizeof($order->products); $subtotal = 0; for ($i = 0; $i < $nProd; ++$i) { $subtotal += $paypal_express->format_raw($order->products[$i]['final_price']) * $order->products[$i]['qty']; } $difst = 0; if ($subtotal != $paypal_express->format_raw($order->info['subtotal'])) { $difst = $paypal_express->format_raw($order->info['subtotal']) - $subtotal; } $order->products[$nProd - 1]['final_price'] += $difst; Can anyone explain the purpose of this? I'm not quite sure why the script seems to be comparing the order subtotal to an aggregate product total, and then offsetting the last item by that difference? Many thanks, Baps. Quote Link to comment Share on other sites More sharing options...
MrPhil Posted April 24, 2014 Share Posted April 24, 2014 I would surmise that they are correcting for any difference between the sum of totals with tax and tax applied to the total price. It's not uncommon for there to be a penny or so difference, and they're just hiding it by adjusting one item's price. The alternative is to have the customer complaining that price totals don't add up. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.