Jump to content

Add to cart: Slow Load


Syns

Recommended Posts

Hi, I'm using Prestashop 1.6.0.14, it's been two days my website suddenly experienced lot of timeout error especially after clicking "Add to cart" it takes more than 20 seconds to show Ajax cart pop up.

 

my hosting provider said that there were so many queries for a shopping cart request and also the POST request after clicking the "Add to Cart" is not returned immediately.

 

here are what I've done:

- Optimized database (clearing abandoned cart, connection information, guest)

- turned off Ajax cart

- disabled google analytic module

- disabled statistic on Cpanel

- changing cache folder and its sub folders permissions to 777

- disabled my custom checkout page

- cleared cache (Prestashop & browser)

- turning on debug mode but I didn't see anything

- restarted web service (Apache & SQL)

 

so any idea what might causing it?

 

any help much appreciated.

 

Thank you

 

 

Link to comment
Share on other sites

I understand, try disabling the ajax cart and turn on the _PS_DEBUG_PROFILING_ on the /config/defines.inc.php, this will show stats of performance, this could help you to find the problem source.

done, here's what it shows after I click "add to cart":

 

"Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 72 bytes) in /home/klik/public_html/tools/profiling/Db.php on line 110"

 

it's on checkout page

Link to comment
Share on other sites

Bump this topic.

 

I finally found what causing this issue, it caused by vouchers lot of it.

I created around 10k vouchers (not stacked but unique ID for each voucher) that caused a long page load sometimes operation timeout error showed up when clicking Add to cart button, when I erased all the vouchers my website returns to normal.

So is there any way to tweak this thing? I really need these vouchers but I don't want it to caused such a heavy load on my site.

 

Thanks

Link to comment
Share on other sites

I suggest to increase memory limit to avoid fatal error.

there are so many voucher as you say thats why it is taking time to show up cart.

 

I've already set memory limit to -1 but it's no help, so I revert back to 1024M. I wonder why prestashop must process cart_rules query (voucher) when adding to cart, it supposes to be on checkout page right?

Link to comment
Share on other sites

The memory limit cannot be changed to unlimited on shared hostings, I really don't know why you need have around 10k cart rules, but definitely you should think about using fewer codes.

Yes, I'm aware that so I asked my hosting provider to changed that,  and btw I'm using a business hosting not shared one.

I need 10k cart rules for an event with my sponsor, they need 10k vouchers with unique ID each of them.

so there's no way to fix this except remove the vouchers?

Link to comment
Share on other sites

  • 2 years later...

I know ist an old thread ... but maybe my solution helps someone who struggles with it ...

check the file System rights.

I used Linux command:

chmod 777 -R *

At the root folder of my shop and the issue was gone.

To be clear, in my case it was an Testserver ... not productiv. 

Do not do this command on your live Server, because it can cause security issues

Please checkout Prestashop documentation how the set the rights properly :)

Link to comment
Share on other sites

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...