Jump to content

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


Recommended Posts

Hello,

 

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'
responseText:
{"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
Link to comment
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.

Link to comment
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.  :)

Link to comment
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...)

 

_______________

  [PrestaShopDatabaseException]

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. }
793.
794. throw new PrestaShopDatabaseException($this->getMsgError());
795. }
796. }
Link to comment
Share on other sites

  • 2 weeks later...

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)
Link to comment
Share on other sites

  • 8 months later...

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.

Link to comment
Share on other sites

  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...