satyr Posted November 2, 2012 Share Posted November 2, 2012 (edited) I've got a strange problem after moving my shop to production server. When I add products to the cart (with clear browser cache and cookies) everything is ok, but after completing the order I can't add other products to make a next order. When I try to add a product, the product's image moves to the cart, but after reloading the page (i.e. changing category or clicking 'view cart'), the cart is empty. When I try to add another product I've got the same situation. I noticed that in the back office -> customers -> shopping carts there are a lot of carts with only one product. It looks like cookies don't keep info about cart_id (but cookies do work, keep me logged in). If you want to check and test this, see (mylink). Shop is in polish, but presta is intuitive Try to make a test order if you want to see what I mean. It doesn't matter which browser you use. Everything was ok on my local server (linux, php 5.3), the problem starts after moving to production server (linux with php 5.3 too). Of course I updated 'shop domain' to "(mylink)" in the back office -> seo&urls, and there is added subdomain "www" in tools -> subdomains (hardcoded in database), but still I can't find where the problem is. Edited November 4, 2012 by satyr (see edit history) Link to comment Share on other sites More sharing options...
satyr Posted November 4, 2012 Author Share Posted November 4, 2012 (edited) Ok, now i know what was happen. I use blockcart2 with ajax. After clicking "add to cart" prestashop sends 3 requests: uncollapse cart (updates cookie with current state), add product, collapse cart. On my local server two of those requests was starting immedietly after click on button. Uncollapse took about 50ms, add product about 200ms and collapse about 50ms, so status of collapse in cookie was updated always before 'add product'. I noticed that on production server time was: uncol: 1s add: 200ms col: 50ms My hosting provider allows only one CGI process so, it doesn't make any sense to start ajax requests asynchronous, because first request waits for finish of second one. In addition the first one remembers cookie state, so after execution the first request reverts cart state to initial. The solution is very simple. Add "async: false" param to ajax request on uncollapse method in ajax-cart.js $.ajax({ type: 'GET', url: baseDir + 'modules/blockcart2/blockcart-set-collapse.php', async: false, data: 'ajax_blockcart_display=expand' + '&rand=' + new Date().getTime() }); Edited November 4, 2012 by satyr (see edit history) 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