Jump to content

Can not add item to shopping cart after enabling Friendly url


Recommended Posts

We are using Prestashop 1.5.2. When the friendly URL was disabled all the functionality of the site was okay, but as we enable the friendly URL and added the www with in the domain name from Prestashop Admin, we found that the login and Add to Cart functionality is not working properly, that means, sometimes this is working, and sometimes this is not. For example, First I open a browser, try to login into the site we found that, login is not working, then we clear the browser Cache and Cookies, and then try to login again, that time login is working.

 

We can not findout what the problem is, does anyone have any idea regarding this issue?

 

Thank you.

Link to comment
Share on other sites

i think that the problem may be related to the javascript issues, turn on browser console and check the error log, maybe some errors appear there while youre trying to add something to cart. If so - please paste the error code.

Link to comment
Share on other sites

  • 2 months later...

While this thread is a few months old it came up as the first result on my google search when trying to find a solution to the same problem so I'll post the solution that worked for me in case someone else stumbles upon this thread.

 

Apparently after changing the "friendly url" setting the htaccess file needs to be regenerated but for some reason this regeneration did not occur. By deleting the existing htaccess file in the root directory and saving the settings again a new htaccess file was built which seemingly solved my problem.

 

**Edit** This solution held up for a few hours before the issue reoccured. Back to looking for a permanent fix.

Edited by [email protected] (see edit history)
Link to comment
Share on other sites

  • 4 months later...

Hi,

 

After another few months, here's some further clues.

The cause of this issue is, in a way or another, malformed json response and the file responsible of taking care of the json response is modules/blockcart/blockcart-json.tpl with the default theme and you should also be looking for a file generating json for other templates where this module is not used.

The general approach to fix it is to open firebug and watch the Net tab while trying to add something to cart.

You will see a line with cart.php... with 301 Moved permanently.

The next line will be index.php... with 200 OK. Open the details for this line and you will see the JSON output responsible for the error,  there. Check it, locate the JSON error and alter blockcart-json.tpl file accordingly so it will produce a valid JSON.

 

I hope this helps to someone else in the future.

Link to comment
Share on other sites

×
×
  • Create New...