Jump to content

The so famous "impossible to add the product to the cart" issue

Recommended Posts



After activating the friendly url, ajax cart started not to work anymore given this message hereunder when adding an article to the cart. And in fact there is no error as the product is well added to the cart despite the message


Impossible to add the product to the cart.
textStatus: 'parsererror'
errorThrown: 'SyntaxError: Unexpected token  in JSON at position 0'
{"products":[{"id":8,"link":"http:\/\/koselya.com\/fr\/chemises-hommes\/8-absolue-homme.html#\/taille-40","quantity":4,"image":"http:\/\/koselya.com\/137-home_default\/absolue-homme.jpg","image_cart":"http:\/\/koselya.com\/137-cart_default\/absolue-homme.jpg","priceByLine":"600,00 \u20ac","name":"Absolue","price":"600,00 \u20ac","price_float":500,"idCombination":10,"idAddressDelivery":5,"is_gift":false,"hasAttributes":true,"attributes":"40","hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[],"shippingCost":"0,00 \u20ac","shippingCostFloat":0,"wrappingCost":"0,00 \u20ac","nbTotalProducts":4,"total":"600,00 \u20ac","productTotal":"600,00 \u20ac","freeShipping":"0,00 \u20ac","freeShippingFloat":0,"free_ship":true,"isVirtualCart":false,"hasError":false}
So I removed friendly url but the issue stays.
So I desactivated Ajax cart and it worked (it seems this is the sad end for most of the people having the issue).
Now I put back the friendly URL as it doesn't change anything anymore.
But I want the ajax cart to be back.
The strangest thing with this issue is that I am connected with English language (id=2) I don't have the issue, and while connected in French (id=1) I get the issue...
My website : http://koselya.com (ajax is deactivated as I have customer wishing to use a working website...)
If anyone has a robust proposal?
PS : I have no google analytic activated, nor paypal and I tried everything on the forums without any working solution

Share this post

Link to post
Share on other sites
The problem that you are facing might be occurring because of some recent changes that you have done on your store. You can try reverting the recent changes and see if this fixes your issue or not.


You can also try the following module.



It offers a better design and doesn't have any issue while adding products to cart. It is a standalone module and doesn't have any dependency on any other module.

Share this post

Link to post
Share on other sites

Thank you for the proposal.


Yes the issue immediately appeared after activating the friendly urls (and nothing else) but when reverting the issue stays... 

Share this post

Link to post
Share on other sites

please check that you do not have PrestaShop debug mode enabled, this can cause cart to fail and maybe when you enable frienendly there is  some code that is getting a warning..


if not enabled, then enable it to see if there is php error displayed....


without looking for error as underlying reason...then all  hope  is lost.  :)

Share this post

Link to post
Share on other sites

Thanks a lot for your answer, debug mode is not activated.


While activated I can't even access to the product page to test the "add to cart" button (see hereunder message).


But nevermind, I commented lines 791 and 794 of the Db.php file and was able to access to the product and to test the "add  button", result is exactly the same and no PHP error displayed...


Again the strangest point with my issue is that it works with one of the language and not with the other. By reading the number of pages on blogs on this issue I know I am not the only one in my situation and that the sad result is that most of the people deactivate the ajax cart (or goes to another solution, which will be maybe my choice at the end...)




Table 'ovh_prestashop.iwl775favorite_product' doesn't exist

            SELECT COUNT(*)
            FROM `iwl775favorite_product`
            WHERE `id_customer` = 1
            AND `id_product` = 11
            AND `id_shop` = 1 LIMIT 1

at line 791 in file classes/db/Db.php


786. if ($webservice_call && $errno) {
787. $dbg = debug_backtrace();
788. WebserviceRequest::getInstance()->setError(500, '
 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
789. } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {
790. if ($sql) {
791. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
792. }
794. throw new PrestaShopDatabaseException($this->getMsgError());
795. }
796. }

Share this post

Link to post
Share on other sites

In http://koselya.com :

- appearance (CSS formating) is different in english and in french)

- the web brower icon appears only on english pages (and admin) but not on french table


In French language, fancybox does not popup for sizetranslation module (on product #display size chart, please refer to printscreen). It is also blocking "add to cart" fancybox popup when AJAX cart is activated.

Issue was traced by Prestashop support to 
classes/Language.phpfunction getIsoById()

the issue was post on forge but no answer so far


any idea someone ?

UTF formating didn't solve the problem

Edited by Koselya (see edit history)

Share this post

Link to post
Share on other sites

I have been banging my head for quite a while, trying to figure this one out...

In my research of this issue, someone mentioned that their database had an invalid field?

The only application I have used that utilises the database in such a way was RockPOS.

So, I un-installed it and - bingo! Website back to working again.

Obviously the RockPOS module is the issue, so I will be contacting the developer and asking for my money back.

Share this post

Link to post
Share on other sites

Sorry my poor English, I was having the same problem and I hit my head a long time until I could solve it, at least mine went back to work, I enabled  output_buffering = On  in  hp.ini on the server and the ajax part of the add button again worked to cart.

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More