Skip to content
Permalink
Browse files

Make PayPal total match OpenCart total

As PayPal uses less precision in its calculations, its total can differ
from the cart total. Calculating subtotal this way ensures they match.
  • Loading branch information...
ADDCreative committed Nov 24, 2015
1 parent 795bf86 commit c34c867efd9ee659ccfe596d40a50f6ecba8ccc4
Showing with 7 additions and 2 deletions.
  1. +7 −2 upload/catalog/controller/payment/pp_standard.php
@@ -24,6 +24,8 @@ public function index() {
$data['products'] = array();
$subtotal = 0;
foreach ($this->cart->getProducts() as $product) {
$option_data = array();
@@ -46,10 +48,13 @@ public function index() {
);
}
$price = $this->currency->format($product['price'], $order_info['currency_code'], false, false);
$subtotal += $price * $product['quantity'];
$data['products'][] = array(
'name' => htmlspecialchars($product['name']),
'model' => htmlspecialchars($product['model']),
'price' => $this->currency->format($product['price'], $order_info['currency_code'], false, false),
'price' => $price,
'quantity' => $product['quantity'],
'option' => $option_data,
'weight' => $product['weight']
@@ -58,7 +63,7 @@ public function index() {
$data['discount_amount_cart'] = 0;
$total = $this->currency->format($order_info['total'] - $this->cart->getSubTotal(), $order_info['currency_code'], false, false);
$total = $this->currency->format($this->currency->convert($order_info['total'], $this->config->get('config_currency'), $order_info['currency_code']) - $subtotal, $order_info['currency_code'], 1.0, false);
if ($total > 0) {
$data['products'][] = array(

0 comments on commit c34c867

Please sign in to comment.
You can’t perform that action at this time.