-
Posts
111 -
Joined
-
Last visited
-
Days Won
3
motion2082 last won the day on August 7 2018
motion2082 had the most liked content!
Profile Information
-
Location
Perth
-
First Name
Paul
-
Last Name
Dickson
motion2082's Achievements
Newbie (1/14)
45
Reputation
-
Anyone seen this error before in Prestashop 1.6.1.23 on PHP7.1 "Field: transactions[0].amount.total Issue: Currency amount must be non-negative number and can optionally contain exactly two decimal places separated by '.', optional thousands separator ',', limited to seven digits before the decimal point." OR "Field: transactions[0].amount.total Issue: Currency amount must be non-negative number and can optionally contain exactly two decimal places separated by '.', optional thousands separator ',', limited to seven digits before the decimal point."
-
Can anyone help me figure out why this won't work on PHP7.1 but it will work on PHP5.6? <?php /** * 2007-2014 PrestaShop * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use * International Registered Trademark & Property of PrestaShop SA */ include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); include(dirname(__FILE__).'/npaypalpro.php'); $paypalpro = new NpaypalPro(); function fillShipping($shipping_address) { $shipping = array(); $shipping['recipient_name'] = $shipping_address->address1; $shipping['line1'] = $shipping_address->address1; $shipping['city'] = $shipping_address->city; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT iso_code FROM ' ._DB_PREFIX_.'country WHERE id_country = '.$shipping_address->id_country); $shipping['country_code'] = $result['iso_code']; $shipping['postal_code'] = $shipping_address->postcode; return $shipping; } if ($paypalpro->active) { $context = Context::getContext(); /* Loading current billing address from PrestaShop */ if (!isset($context->cart->id) || empty($context->cart->id) || !isset($context->cart->id_address_invoice) || empty($context->cart->id_address_invoice)) die('No active shopping cart'); $billing_address = new Address((int)$context->cart->id_address_invoice, false); $shipping_address = new Address((int)$context->cart->id_address_delivery, false); if (isset($billing_address) && isset($shipping_address) && isset($context->customer->email)) { $shipping = fillShipping($shipping_address); $currency = $context->currency->iso_code; $transaction = array(); $transaction['intent'] = 'sale'; $transaction['payer'] = array(); $transaction['payer']['payment_method'] = 'credit_card'; $transaction['payer']['payer_info'] = array(); $transaction['payer']['payer_info']['email'] = $context->customer->email; $transaction['payer']['payer_info']['shipping_address'] = $shipping; /* Retrieving Country and State ISO codes */ $billing_country = new Country((int)$billing_address->id_country); if (isset($billing_country)) { if ($billing_address->id_state) $billing_state = new State((int)$billing_address->id_state); if ($shipping_address->id_state) $shipping_state = new State((int)$shipping_address->id_state); } $cart = new Cart((int)$context->cart->id); if (isset($cart)) { $items = array(); $tab = $cart->getProducts(); $discounts = $cart->getDiscounts(); /* Update shipping price */ if (preg_match('/\.(\d{2})$|^\d*$/', $cart->getTotalShippingCost())) $shipping_price = $cart->getTotalShippingCost(); else $shipping_price = $cart->getTotalShippingCost().'0'; $shipping_item = array( 'quantity' => 1, 'name' => 'Shipping', 'price' => $shipping_price, 'currency' => $currency ); if ($cart->gift) { /* Update gift price */ if (preg_match('/\.(\d{2})$|^\d*$/', $cart->getGiftWrappingPrice())) $gift_price = $cart->getGiftWrappingPrice(); else $gift_price = $cart->getGiftWrappingPrice().'0'; $gift = array( 'quantity' => 1, 'name' => 'Gift', 'price' => $gift_price, 'currency' => $currency ); } if (isset($tab)) { foreach ($tab as $product) { $item = array(); $item['quantity'] = $product['quantity']; $item['name'] = $product['name']; $price = round($product['price_wt'], 2); if (preg_match('/\.(\d{2})$|^\d*$/', $price)) $item_price = $price; else $item_price = $price.'0'; $item['price'] = $item_price; $item['currency'] = $currency; array_push($items, $item); } array_push($items, $shipping_item); if ($cart->gift) array_push($items, $gift); } /* get Discount Price */ if (!empty($discounts)) { foreach ($discounts as $discount) { /* Update discount price */ $formDiscount = number_format($discount['value_tax_exc'], 2); if (preg_match('/\.(\d{2})$|^\d*$/', $formDiscount)) $discount_price = '-'.$formDiscount; else $discount_price = '-'.$formDiscount.'0'; $disc = array( 'quantity' => 1, 'name' => $discount['name'], 'price' => $discount_price, 'currency' => $currency ); } array_push($items, $disc); } $item_list = array(); $item_list['items'] = $items; $item_list['shipping_address'] = $shipping; $credit_card = array(); $credit_card['number'] = preg_replace('/\s+/', '', Tools::getValue('paypal_pro_cc_number')); $credit_card['type'] = Tools::strtolower(Tools::getValue('paypal_pro_cc_type')); $credit_card['expire_month'] = (int)Tools::getValue('paypal_pro_cc_exp_month'); $credit_card['expire_year'] = (int)Tools::getValue('paypal_pro_cc_year'); $credit_card['cvv2'] = Tools::getValue('paypal_pro_cc_cvv'); $credit_card['first_name'] = Tools::substr(Tools::getValue('paypal_pro_cc_firstname'), 0, 25); $credit_card['last_name'] = Tools::substr(Tools::getValue('paypal_pro_cc_lastname'), 0, 25); $credit_card['billing_address'] = array(); $credit_card['billing_address']['line1'] = $billing_address->address1; if (isset($billing_address->address2) && !empty($billing_address->address2)) $credit_card['billing_address']['line2'] = $billing_address->address2; $credit_card['billing_address']['city'] = $billing_address->city; if ($billing_address->id_state && isset($billing_state->iso_code)) $credit_card['billing_address']['state'] = Tools::strtoupper(Tools::substr($billing_state->iso_code, 0, 2)); $credit_card['billing_address']['postal_code'] = $billing_address->postcode; $credit_card['billing_address']['country_code'] = Tools::strtoupper(Tools::substr($billing_country->iso_code, 0, 2)); $transaction['payer']['funding_instruments'] = array(array('credit_card' => $credit_card)); $amount = array(); if (preg_match('/\.(\d{2})$|^\d*$/', $context->cart->getOrderTotal(true))) $amount['total'] = $context->cart->getOrderTotal(true); else $amount['total'] = $context->cart->getOrderTotal(true).'0'; $amount['currency'] = $context->currency->iso_code; /* Total Amount check */ $diff = totalAmountCheck($amount['total'], $item_list['items']); // this verification is made because of the US taxes /* If amountcheck != $amount */ if ($diff != 0) { $price = $diff > 0 ? '-'.$diff : abs($diff); $item = array(); $item['quantity'] = 1; $item['name'] = 'Voucher taxes'; $item['price'] = $price; $item['currency'] = $currency; array_push($item_list['items'], $item); } $transaction['transactions'] = array(array('amount' => $amount, 'description' => 'PrestaShop - Customer: ' .$context->customer->email.' | Shopping Cart ID: '.(int)$context->cart->id, 'item_list' => $item_list)); /* Make payment */ $paypalpro->apiRequest('v1/payments/payment', $transaction); } } } function totalAmountCheck($amount, $items) { $amountCheck = $diff = 0; foreach ($items as $item) $amountCheck += number_format((int) $item['quantity'] * (float) $item['price'], 2); if ($amountCheck != $amount) $diff = number_format($amountCheck - $amount, 2); return $diff; }
-
Have an error in my PayPal module on ourPrestashop site. It says [30-Oct-2018 10:37:19 Australia/Sydney] PHP Notice: A non well formed numeric value encountered in /home/public_html/modules/npaypalpro/ajax.php on line 214 Line 214 is $amountCheck += number_format($item['quantity'] * $item['price'], 2); Any ideas what might be the cause? PHP7.1 on the server PayPal said Full function function totalAmountCheck($amount, $items) { $amountCheck = $diff = 0; foreach ($items as $item) $amountCheck += number_format($item['quantity'] * $item['price'], 2); if ($amountCheck != $amount) $diff = number_format($amountCheck - $amount, 2); return $diff; }
-
Hey guys, Updated Prestashop to 1.6.1.22 / PHP 7.1 and now we have an error on our PayPal Payments Pro module. Contacted the developer but still waiting on a response. Will post here with a solution if I find one but if anyone already has one please share your fix. Error Log: [30-Oct-2018 10:37:19 Australia/Sydney] PHP Notice: A non well formed numeric value encountered in /public_html/modules/npaypalpro/ajax.php on line 214 Line 214 is $amountCheck += number_format($item['quantity'] * $item['price'], 2); Which is part of this function function totalAmountCheck($amount, $items) { $amountCheck = $diff = 0; foreach ($items as $item) $amountCheck += number_format($item['quantity'] * $item['price'], 2); if ($amountCheck != $amount) $diff = number_format($amountCheck - $amount, 2); return $diff; }
-
Spinning Save and Save button, Prestashop 1.6.1.3
motion2082 replied to carinac's topic in General topics
Thank you for this, I applied to PS 1.6.1.22 this morning. Error Log for PS Developers although 1.6 is on its way out so if it hasn't been fixed by now...it won't be in the future Uncaught TypeError: Cannot read property 'length' of undefined at Function.each (jquery-1.11.0.min.js:2) at Object.success (notifications.js:51) at j (jquery-1.11.0.min.js:2) at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2) at x (jquery-1.11.0.min.js:4) at XMLHttpRequest.b (jquery-1.11.0.min.js:4) 08:49:45.616 index.php?controller=AdminProducts&id_product=104&updateproduct&token=96249ae8e3bce24b8ebb730b1f4ead2b:1 [DOM] Found 4 elements with non-unique id #product_form_submit_btn: (More info: https://goo.gl/9p2vKq) <button id="product_form_submit_btn" type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled">…</button> <button id="product_form_submit_btn" type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled">…</button> <button id="product_form_submit_btn" type="submit" name="submitAddproduct" class="btn btn-default pull-right" disabled="disabled">…</button> <button id="product_form_submit_btn" type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right" disabled="disabled">…</button> 08:49:59.684 VM3951:41 Uncaught SyntaxError: Unexpected token , at eval (<anonymous>) at jquery-1.11.0.min.js:2 at Function.globalEval (jquery-1.11.0.min.js:2) at e.fn.init.domManip (jquery-1.11.0.min.js:3) at e.fn.init.append (jquery-1.11.0.min.js:3) at e.fn.init.<anonymous> (jquery-1.11.0.min.js:3) at n.access (jquery-1.11.0.min.js:3) at e.fn.init.html (jquery-1.11.0.min.js:3) at Object.success (products.js:127) at j (jquery-1.11.0.min.js:2) -
Did you end up solving your issue? For me I had to re-enable overrides and fix a file in my error log
-
Hey guys, Looks like the PS 1.6.1.22 upgrade is very small. Don't want to upgrade the whole store if I have too Which files have they changed? Can't find any reference anywhere Regards, Motion
-
RE: Anyone know why Yotpo is no longer supporting PS?
motion2082 replied to motion2082's topic in General topics
Hi Knowband, This is what I received from their support Thanks for contacting Yotpo support. Please note that Prestashop currently does not have a native integration with Yotpo. In order to install Yotpo on PRestashop, please follow this guide. Within the guide you will find all of the necessary steps to install the app on your Prestashop site, and the necessary codes. Please note that we are here to guide you through this process Haver a lovely week!Kind Regards,Dana ShamirYotpo Growth Support HeroWant to have all the answers at your fingertips? Yotpo's Help Center to the rescue!-http://support.yotpo.com/ -
Things seem to be getting worse for Prestashop. Yotpo no longer supporting the platform Anyone know why this is the case? https://support.yotpo.com/en/article/prestashop-installing-yotpo
-
Hey guys, Followed this documentation - https://devdocs.prestashop.com/1.7/themes/reference/template-inheritance/parent-child-feature/ to create a child theme from Classic Theme but it doesn't show up in the admin area? Any one been successful with this? Regards, Motion
-
Hey guys, Just installed a module where there is an override in the module/override/controller/admin/AdminOrderControllers.php file Problem is we already have an override for another module using AdminOrdersController.php in public_html/overrides I tried combining these two together but the module override doesn't work. What is the best way to do this?