tdr170 Posted January 31, 2015 Share Posted January 31, 2015 (edited) As you can see from the code below I am getting 4 decimal places showing in the item amount which leads to PayPal error. Price shows correct in back office, blockcart and shopping cart. The link you have used to enter the PayPal system contains an incorrectly formatted item amount. This is the code from Chrome inspector as you can see the item amount shows 4 decimal places while the total does not. I don't really think this is a PayPal issue as I tried with 1.3.3 and 1.3.8 with same result. Anyone else seen or heard of this issue. (removed sensitive info) <p class="payment_module"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="charset" value="utf8"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="custom" value="854;1"> <input type="hidden" name="amount" value="488.95"> <input type="hidden" name="address_override" value="1"> <input type="hidden" name="item_name_1" value="Velox V10 "Pro" 2014"> <input type="hidden" name="amount_1" value="450.0045"> <input type="hidden" name="quantity_1" value="1"> <input type="hidden" name="item_name_2" value="Shipping"> <input type="hidden" name="amount_2" value="11.95"> <input type="hidden" name="quantity_2" value="1"> <input type="hidden" name="tax_cart" value="27"> Edited January 31, 2015 by tdr170 (see edit history) 1 Link to comment Share on other sites More sharing options...
tdr170 Posted January 31, 2015 Author Share Posted January 31, 2015 Found the issue it is the classes/cart.php file changed to version from 1.6.0.9 and the amount is correct however now the order goes through to PayPal, log in, make payment but when you return to site items are still in cart. The order does show in my PayPal account but not in the back office, so I can not use 1.6 as none of the Payment modules work what the Hell. Link to comment Share on other sites More sharing options...
Carolina Custom Designs Posted February 12, 2015 Share Posted February 12, 2015 I am having the exact same issue on a new installation of 1.6.0.11. So far I have not been able to resolve the problem. Did you find a solution? Marty Shue Link to comment Share on other sites More sharing options...
tdr170 Posted February 15, 2015 Author Share Posted February 15, 2015 (edited) No solution to order not showing at this point I think I will have to start all over if I want a 1.6 site, you would think that Presta would respond as I see so many with this issue.I only hope that I can at least get the customer accounts using the database to show so all the customers want have to recreate their accounts, THIS SUCKS. Edited February 24, 2015 by tdr170 (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted February 15, 2015 Share Posted February 15, 2015 An order not being created means the Paypal IPN is not either not being received, or is being received but is failing to be processed. The first thing you need to do is determine if the IPN is even being received. For this, I always suggest looking at the access logs. Link to comment Share on other sites More sharing options...
lecairelinens Posted February 24, 2015 Share Posted February 24, 2015 We are having the same issue any item with currency conversion or sale price rule gets more than 2 digits in the decimals For example, if an Item is $1 USD and the exchange rate to CAD is 1.2234 and we set the decimal rounding to 2 The cart will show 1.22, but the line item in the paypal form is <input type="hidden" name="amount_1" value="1.2234" /> which paypal rejects as invalid Error: The link you have used to enter the PayPal system contains an incorrectly formatted item amount. This is on paypal Express Checkout. Link to comment Share on other sites More sharing options...
bellini13 Posted February 24, 2015 Share Posted February 24, 2015 We are having the same issue any item with currency conversion or sale price rule gets more than 2 digits in the decimals For example, if an Item is $1 USD and the exchange rate to CAD is 1.2234 and we set the decimal rounding to 2 The cart will show 1.22, but the line item in the paypal form is <input type="hidden" name="amount_1" value="1.2234" /> which paypal rejects as invalid Error: The link you have used to enter the PayPal system contains an incorrectly formatted item amount. This is on paypal Express Checkout. what version of Paypal USA are you using? Link to comment Share on other sites More sharing options...
lecairelinens Posted February 24, 2015 Share Posted February 24, 2015 Same as the person initiated the threadPayPal USA, Canada v1.3.8 - by PrestaShop Both PrestaShop version 1.6.0.12 - Local InstallAnd PrestaShop version 1.6.0.11 (Cloud) Link to comment Share on other sites More sharing options...
tdr170 Posted February 24, 2015 Author Share Posted February 24, 2015 The other way to fix this is to edit the database tables for ps_products and ps_products_shop, once you click on the table look at the list and you will see that just about all tables with something to do with prices are set like this 20,6 I changed all these to 20,2 and the decimal issue seems to have gone. Can someone else can check this on their site. Link to comment Share on other sites More sharing options...
msfblue Posted February 26, 2015 Share Posted February 26, 2015 Hi, I had the same problem. I used prestashop 1.5.5 and paypal usa 1.3.3 . The only way I could fix was changing the template standard.tpl paypal module (/modules/paypalusa/views/templates/hook/standard.tpl).My shop has three currencies: Colombian pesos (default or main), dollars and euros. Paypal only throws the error when I pay in dollars or euros. Before I change the template, remove the option of decimals by currency (location / currency). In the template standard.tpl I add the modifier ceil all float values : {$paypal_usa_product.price|floatval|ceil} This is an example of the complete line <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval}" /> I'm still testing this, I hope that someone can help you .Regards Link to comment Share on other sites More sharing options...
lethal Posted March 6, 2015 Share Posted March 6, 2015 I am having the same problem and this is the second time this USA /Canada PayPal module has not worked properly and caused me to have abandoned carts. I am going with authorized.net and not using this crappy PayPal module ever again. Link to comment Share on other sites More sharing options...
bitwiz Posted March 10, 2015 Share Posted March 10, 2015 (edited) We had the same problem with the paypal usa module in our site. Here's how I corrected the problem: I added a function at the bottom of classes/cart.php right before the closing curly brace ( } ). public function roundAmount($a){ return Tools::ps_round($a, _PS_PRICE_COMPUTE_PRECISION_); } } Then in the paypalusa/views/templates/hook/standard.tpl file, change the "value" on the HTML like so: <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$cart->roundAmount($paypal_usa_product.price)}" /> <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+2|escape:'htmlall':'UTF-8'}" value="{$cart->roundAmount($paypal_usa_total_shipping)}" /> This is only a temporary fix and will probably get over-written if you upgrade prestashop or paypal usa, but at least it's working again. Edited March 10, 2015 by bitwiz (see edit history) 1 Link to comment Share on other sites More sharing options...
papagino Posted March 17, 2015 Share Posted March 17, 2015 Hi bitwiz, Is your fix working for PayPal USA, Canada v1.3.8 module? Thanks Daniel Link to comment Share on other sites More sharing options...
Carolina Custom Designs Posted March 23, 2015 Share Posted March 23, 2015 Hi all, I have the decimal issue solved but now when we place test orders using Paypal no order shows in the BO or customer account history. Anyone find a solution for this issue? Marty Shue Link to comment Share on other sites More sharing options...
bitwiz Posted March 23, 2015 Share Posted March 23, 2015 (edited) Yes, we're on Paypal USA/Canada 1.3.8. Edited March 23, 2015 by bitwiz (see edit history) Link to comment Share on other sites More sharing options...
MaxToreador Posted March 28, 2015 Share Posted March 28, 2015 I've tried the above edits to my Cart.php and standard.tpl and both just seem to crash the cart page. Any new fixes or advice? Link to comment Share on other sites More sharing options...
finlanderid Posted April 8, 2015 Share Posted April 8, 2015 (edited) In standard.tpl, about line 45, just use Smarty to format the float to two decimal places. Tested and worked flawlessly with USD, GBP and EUR, both to and from paypal.com (including purchase).Remember to re-compile or else you won't see the effect. Change this: <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval}" /> To this: <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval|number_format:2}" /> Edited April 8, 2015 by finlanderid (see edit history) 3 Link to comment Share on other sites More sharing options...
bitwiz Posted April 8, 2015 Share Posted April 8, 2015 That's a better solution. Thanks! Link to comment Share on other sites More sharing options...
chvchd Posted April 8, 2015 Share Posted April 8, 2015 I confirm too! the solution from finlanderid is working. Thanks Link to comment Share on other sites More sharing options...
shizhu2 Posted April 9, 2015 Share Posted April 9, 2015 Well Done! Thanks a lot! Link to comment Share on other sites More sharing options...
Bewitching Posted April 28, 2015 Share Posted April 28, 2015 finlanderid, You ROCK !!!I was going nuts trying figure this out!Googling the issue didn't help because I HAD it set in the backend for 2 decimal places.I hope this gets fixed in the code and they give you a freee coffee for figuring it out Thanks again! Kathleen (I'm adding your solution to my post so others can see it easily as a solution!) In standard.tpl, about line 45, just use Smarty to format the float to two decimal places. Tested and worked flawlessly with USD, GBP and EUR, both to and from paypal.com (including purchase).Remember to re-compile or else you won't see the effect. Change this: <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval}" /> To this: <input type="hidden" name="amount_{$smarty.foreach.paypal_usa_products.index+1|escape:'htmlall':'UTF-8'}" value="{$paypal_usa_product.price|floatval|number_format:2}" /> 2 Link to comment Share on other sites More sharing options...
finlanderid Posted April 28, 2015 Share Posted April 28, 2015 (edited) Thanks. Glad you were able to make it work. Yes, it was very difficult to try to fix in the php, because of a bunch of other "moving parts" re: currencies and rounding that can't be tampered with, and the setting in the BO simply does not impact that part of the PayPal module (when front-end changes to a non-store-default currency). The Smarty solution is not ideal but works OK. I have not tried yet, but if someone really needed to, you could even try using the PS constant (for decimal places) instead of the number 2. That would make it more dynamic and proper. Edited April 28, 2015 by finlanderid (see edit history) Link to comment Share on other sites More sharing options...
hpfan28 Posted June 10, 2015 Share Posted June 10, 2015 I was having this problem also, and was able to fix it using this solution. Thanks so much, Prestashop community rocks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now