Jump to content
sini

After add to cart, cart is empty

Recommended Posts

Dear, I have got problem,

 on some computers (I have only one PC where this error is - Win10 home 32bit, Firefox 56.0.2 (32 bit)) after click add to cart button, Presta shows me that product was added to cart, after click on cart, cart is empty. 

 I have no other computer where it do the same, on this computer in IE and in Chrome it works well. I had call from customer that she can't add products to cart, so it isn't only this PC.

 PrestaShop 1.6.0.9

I tried: 
- turn off ccc
- empty cache
- turn off ajax cart
nothing made any changes :-(

In firefox i had, in console are these errors - see attachment.

 

Screen Shot 2017-10-30 at 12.22.12.png

Share this post


Link to post
Share on other sites

I found these two possible causes:
 

1. ID_CART number problem (I haven't this problem) - 

2. COOKIES www and non-www problem (it's my problem!) - 

 

So questions are: how to disable in presta to make non-www cookies? How to delete existing non-www cookies?

 

 

Share this post


Link to post
Share on other sites

No One with same problem? 
At the moment I changed name of cookie in /classes/Cookie.php and It looks like it works.

form
this->_name = 'PrestaShop-'.md5(($this->_standalone ? '' : _PS_VERSION_).$name.$this->_domain);

to
this->_name = 'PrestaShop1-'.md5(($this->_standalone ? '' : _PS_VERSION_).$name.$this->_domain);

 

Share this post


Link to post
Share on other sites

I have same/simillar problem with presta 1.7.4.

Neither cleaning cache didn't help nor manual removal of cookies worked. 

Thank you for posting solution - renaming cookie did it for me too.


 

  • Like 1

Share this post


Link to post
Share on other sites

I had similar issue, add to cart worked except for my home internet!  drove me crazy for months.

Then I emptied the three 'connections' tables in PS...

and cleared up  my issue....

I've not had issue again nor on any client shop...since....thankfully

Share this post


Link to post
Share on other sites

Interesting, I've had this issue before, will try the empty connections tables next time.

Share this post


Link to post
Share on other sites

If I got this wrong, and until I found a backup, this happened
Fatal error: Class 'Cookie' not found in /home/veganlin/public_html/x/config/config.inc.php on line 174
using PS 1.6 on Chrome and Opera using a windows 10 laptop 
Oddly, the error continued after i thought I'd changed the PHP code exactly back

When I tried a second time with a bit of cutting and pasting, the site worked but I still got

"your shopping cart is empty".

Thanks for the idea though.

Share this post


Link to post
Share on other sites

Hello John, we had clients with similar problems. There are several things that can cause this problem:

1. Your cookie have duplicates as you mentioned (www vs non-www).  This can hapen if you do not have propper redirect. For example, client came to your store as mystore.com (first cookie is created), then your configuration redirects user to www version (creation of second cookie occur). Keep in mind that cookies from non-www domain are available across all subdomains, including www. Solution for this case is quite simple, in cookie class, override function that sets cookie, set non-www domain cookie along with www, but for troubled domain, set cookie to expire somewhere in the past

2. Other cookie problem, that manifest itself with empty cart along with login problem (user cannot be loged in, always is redirected back) is problem with cookie size (max size is about 4096 bytes). After some research, we have decrypted clients problematic cookie, and found out that module responsible for this mess is actually "blockviewed". If someone is interested, we could create module that creates overrides for those functions. Hope this helps to understand the problematic behaviour

Share this post


Link to post
Share on other sites

Thanks for help.
By fluke, I found my solution:
https://www.prestashop.com/forums/topic/263900-cart-is-empty-when-check-out/#comment-2938762
... if I turned geolocation on and off again, the cart cookie worked and thumbnail pictures transferred to the shopping cat.

I wish there were a better way of sorting all these threads and solutions. These are my notes made before I found my particular answer:

Google.co.uk/search?q=Prestashop+forum+"your+shopping+cart+is+empty”

prestashop.com/forums/topic/500027-your-shopping-cart-is-empty/ Papermarks thread, January 16
- debug mode. He sometimes get an extra error. I don’t.

- turn Friendly URLS off and on again. I did. 
- if I did get an error, someone suggests a page headed with that error, on which someone links to this:
in class FrontController i change (l.253) :

//'content_dir' => $protocol_content.Tools::getServerName().__PS_BASE_URI__,
'content_dir' => $protocol_content.(($useSSL)?Tools::getShopDomainSsl():Tools::getShopDomain()).__PS_BASE_URI__,

I was about to write this off after failed searches, but “/public_html/x/classes/controller/FrontController.php” and “/public_html/x/classes/controller/ModuleFrontController.php” do exist. In my version. The first is a short file. The second has nothing I could find similar.

Mystery: there is no “front controller” module. But there is a file called modulefrontcontroller. Is this a clue? 


https://www.prestashop.com/forums/topic/447523-shopping-cart-is-empty-error/ GiantRobo thread June 15
- changes subject to no couriers error

https://www.prestashop.com/forums/topic/633254-after-add-to-cart-cart-is-empty/ Sini thread November 17
- summarizes other bugs and suggests a solution on >classes>cookie.php line 76ish, change the name of the cookie. I made the change but still get the empty cart error. Someone suggests emptying the cross-reference tables?

https://www.prestashop.com/forums/topic/636942-your-shopping-cart-is-empty-error/ Milsi thread November 17
About PS 1.5. No replies

https://www.prestashop.com/forums/topic/442877-cart-says-your-cart-is-empty-no-matter-how-many-products-i-add/

About PS? Dprovost thread May 2015
Suggests a test of .css in case is isn’t showing the cart contents by mistake. Test: add

.unvisible { display: none; }

To the end of your theme’s global.css file. I tried. No result when trying the cart in a fresh browser with caches turned off.

https://www.prestashop.com/forums/topic/636942-your-shopping-cart-is-empty-error/

Milsee thread. November 2017. Chrome only. No replies

https://www.prestashop.com/forums/topic/297624-solved-prestashop-156-shopping-cart-is-empty/
Gsoutfits thread PS 1.5 December 2013
This was a css problem stored in the cache.
All my css changes are in a separate editing module. I have disabled it. No result in community theme.

2011 thread skipped as too old

https://www.prestashop.com/forums/topic/392573-solved-empty-cart-problem-1609/

Simon68 / lacepatterns.eu thread, January 2015, PS1.6.0.9 - asks for list of solutions

Turn off ajax cart. Done. Problem remains

Someone lists PSForge bug tracker posts that have helped him
This is very frustrating, but I sympathise with Prestashop developers after reading https://medium.com/@prestashoppoweruser/prestashop-a-sad-story-8b7e0a8795b8
A bug marked “not replicable duplicate” is “closed” over-and-over again, which, to me, is no solution. Aircraft builders do not write “duplicate but not replicable, so solved” if their planes crash so often and inexplicably. Or sometimes they do but that turned-out to be metal fatigue so it was solved eventually.

The lead PHP and MySQL developer suggests disabling non Prestashop themes and modules, and switching back to the default bootstrap theme.

I found a switch in backoffice > advanced parameters > performance to turn-off all non-prestashop modules but id didn’t work, so I went down the list and turned-off each one and saw Prestashop Cleaner offering to tidy my database, and it did:
DELETE FROM `ps_order_carrier` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders`)

2 line(s)

DELETE FROM `ps_order_invoice` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders`)

1 line(s)

DELETE FROM `ps_order_invoice_payment` WHERE `id_order` NOT IN (SELECT `id_order` FROM `ps_orders`)

1 line(s)

DELETE FROM `ps_product_carrier` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`)

1 line(s)

DELETE FROM `ps_specific_price_priority` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`)

1 line(s)

Bug remains.

There is also an option to delete every order and customer record. I have none, so why not?
Orders and customers truncated

Bug remains.

The same developer suggests, if that fails “You should consult your apache logs or the javascript console of your browser”, and try the default bootstrap theme.

My javascript console led me here
example.com/img/p/en-default-home_default.jpg is called rather than
example.com/img/p/1/0/1/101-home_default.jpg

http://forge.prestashop.com/browse/PSCSX-6117 - the thumbnail image of a product is lost instead of going to the cart, even if I re-build thumbnails in the back office. 

There is a patch for the cart.php written on Github, mentioned as a solution to the image problem as though future releases would include that patch, but I am on a future release and I cannot find cart.php, so the patch doesn’t help.

I’ve got this far and am nowhere:
https://www.prestashop.com/forums/topic/392573-solved-empty-cart-problem-1609/#comment-2101779

Now I have found an error message about regional settings deleting carts, which is good.
Now I have also tried deleting and re-instating the /subdirectory/ setting just to clear defaults, but have lost the site entirely. 
https://www.prestashop.com/forums/topic/149001-can-i-change-prestashop-base-url/?do=findComment&comment=2905656
...might be an answer

  • Thanks 1

Share this post


Link to post
Share on other sites

I just reinstall shopping cart module after installing any themes and its woks in my case.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/5/2018 at 11:24 PM, vlado92 said:

2. Other cookie problem, that manifest itself with empty cart along with login problem (user cannot be loged in, always is redirected back) is problem with cookie size (max size is about 4096 bytes). After some research, we have decrypted clients problematic cookie, and found out that module responsible for this mess is actually "blockviewed". If someone is interested, we could create module that creates overrides for those functions. Hope this helps to understand the problematic behaviour 

Thank you very much for this solution. Disabling: "Viewed products block" saved my day.

Share this post


Link to post
Share on other sites

Hi

I had the same thing for one product only: resetting the product quantity helped. Running on 1.7.5.1

Hope it helps someone as well :)

Share this post


Link to post
Share on other sites

Слава небесам, Проблема с корзиной решилась.

Отключил ГЕОЛОКАЦИЮ

Работает на 1.7.6.0

Edited by Toropov67 (see edit history)

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.

Guest
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