Jump to content
Syns

Add to cart: Slow Load

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

 

 

Share this post


Link to post
Share on other sites

Have you installed some carrier module?

No, I haven't added any new carrier.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi,

In your php.ini make memory_limit=-1;

That will solve your issue.

Thanks.

Hi, thanks for your advice, I just changed my memory_limit to -1 but it still takes approx. 30s to show up the ajax cart.

Share this post


Link to post
Share on other sites

Hi, thanks for your advice, I just changed my memory_limit to -1 but it still takes approx. 30s to show up the ajax cart.

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.

 

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

I do not know, maybe could be optimized a little more the way how read the codes, or skip that part, but if your hosting provider can increase memory, maybe that solves the problem.

Share this post


Link to post
Share on other sites

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 :)

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