Jump to content

Add to cart slow .


johnxl

Recommended Posts

Hello !

I am using 1.7.2

When I press add to cart it takes about 6 seconds to popup .

Colors and attributes switches slow too ,about 6 seconds .

I installed fresh copy of  1.7.2 on my second test domain , and there is the same problem from the start .

What can I try to change ?

Thanks .

 

 

Link to comment
Share on other sites

Hello !

Yes I am using free whatsup module . I guess it should work corectcly on 1,7 .

I enabled smart catche for css and js and appache optimization . Now time reduced from 6-7 second to 4 seconds .

I havn't installed any third party modules on my test domain,but there is same situation, about 4 seconds to popup .

Maybe there is problem with instalation process or server configuration ?

 

Link to comment
Share on other sites

I can't guess as to the issue, but apparently the whatsup module does not work properly based on the errors.  So it is entirely possible that you are using modules that are causing issues like errors and slowness.

Your store can run slow depending on the server you are using, modules and themes you have added, or how your web server is configured.

You can see on several of our demo stores that PS runs quick quickly out of the box, so this issue is likely unique to your store and hosting provider.

Link to comment
Share on other sites

Thanks for answer .

On fresh installation without any third party modules  on my test domain add to cart button works slow too . 4 seconds to popup .

I attached some screenshots from my server configurations . Maybe there you can see where is problem ?

 

2.png

1.png

Untitled3.png

Link to comment
Share on other sites

I agree with this:

On 8.11.2017 at 8:27 PM, johnxl said:

When I press add to cart it takes about 6 seconds to popup .

Colors and attributes switches slow too ,about 6 seconds .

I installed fresh copy of  1.7.2 on my second test domain , and there is the same problem from the start .

 

I check Chrome console and here is a screen

image.thumb.png.b964e485bb4b2734500e2cbcd8b93fc9.png

 

Something is wrong with cart module. We have only 30 products and lot of attributes in only one product. The shop slow down when you add more than 5 products to cart. We don't have bugs in modules and debug profile show this:

Load Time 5568 ms - You'd better run your shop on a toaster
Querying Time 663 ms
Queries 1017
Memory Peak Usage 64.5 Mb
Included Files 436 files - 6.73 Mb
PrestaShop Cache 0.01 Mb
Global vars 0.18 Mb
PrestaShop Version 1.7.2.4
PHP Version 5.4.45-0+deb7u11 (OK)
MySQL Version 5.5.58-0+deb7u1 (Consider upgrading)
Memory Limit 2048M
Max Execution Time 1200s
Smarty Cache enabled
Smarty Compilation

never recompile

 

 

doubles:

382
SELECT SUM(`quantity`)
				FROM `ps_cart_product`
				WHERE `id_product` = XX
				AND `id_cart` = XX LIMIT XX

 

68
			SELECT pa.`id_product`, a.`color`, pac.`id_product_attribute`, SUM(IF(stock.`quantity` > XX, XX, XX)) qty, a.`id_attribute`, al.`name`, IF(color = "", a.id_attribute, color) group_by
			FROM `ps_product_attribute` pa
			 INNER JOIN ps_product_attribute_shop product_attribute_shop
        ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = XX) LEFT JOIN ps_stock_available stock
			ON (stock.id_product = `pa`.id_product AND stock.id_product_attribute = IFNULL(`pa`.id_product_attribute, XX) AND stock.id_shop = XX  AND stock.id_shop_group = XX  )
			JOIN `ps_product_attribute_combination` pac ON (pac.`id_product_attribute` = product_attribute_shop.`id_product_attribute`)
			JOIN `ps_attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
			JOIN `ps_attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = XX)
			JOIN `ps_attribute_group` ag ON (a.id_attribute_group = ag.`id_attribute_group`)
			WHERE pa.`id_product` IN (XX) AND ag.`is_color_group` = XX
			GROUP BY pa.`id_product`, a.`id_attribute`, `group_by`
			HAVING qty > XX
			ORDER BY a.`position` ASC;
63
SELECT SUM(quantity)
FROM `ps_stock_available`
WHERE (id_product = XX) AND (id_product_attribute = XX) AND (id_shop = XX) AND (id_shop_group = XX) LIMIT XX
62
			SELECT a.`id_attribute`, a.`id_attribute_group`, al.`name`, agl.`name` as `group`, pa.`reference`, pa.`eanXX`, pa.`isbn`,pa.`upc`
			FROM `ps_attribute` a
			LEFT JOIN `ps_attribute_lang` al
				ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = XX)
			LEFT JOIN `ps_product_attribute_combination` pac
				ON (pac.`id_attribute` = a.`id_attribute`)
			LEFT JOIN `ps_product_attribute` pa
				ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
			 INNER JOIN ps_product_attribute_shop product_attribute_shop
        ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = XX)
			LEFT JOIN `ps_attribute_group_lang` agl
				ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = XX)
			WHERE pa.`id_product` = XX
				AND pac.`id_product_attribute` = XX
				AND agl.`id_lang` = XX
38
SELECT `id_product_attribute`
			FROM `ps_product_attribute`
			WHERE `id_product` = XX
37
			SELECT image_shop.`cover`, i.`id_image`, il.`legend`, i.`position`
			FROM `ps_image` i
			 INNER JOIN ps_image_shop image_shop
        ON (image_shop.id_image = i.id_image AND image_shop.id_shop = XX)
			LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = XX)
			WHERE i.`id_product` = XX
			ORDER BY `position`
36
			SELECT cd.`id_customization`, c.`id_address_delivery`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`,
				cd.`type`, cd.`index`, cd.`value`, cd.`id_module`, cfl.`name`
			FROM `ps_customized_data` cd
			NATURAL JOIN `ps_customization` c
			LEFT JOIN `ps_customization_field_lang` cfl ON (cfl.id_customization_field = cd.`index` AND id_lang = XX)
			WHERE c.`id_cart` = XX AND c.`in_cart` = XX
			ORDER BY `id_product`, `id_product_attribute`, `type`, `index`
36
                SELECT COUNT(`id_customization`) FROM `ps_cart_product`
                WHERE `id_cart` = XX AND `id_customization` != XX LIMIT XX
32
			SELECT pai.`id_image`, pai.`id_product_attribute`, il.`legend`
			FROM `ps_product_attribute_image` pai
			LEFT JOIN `ps_image_lang` il ON (il.`id_image` = pai.`id_image`)
			LEFT JOIN `ps_image` i ON (i.`id_image` = pai.`id_image`)
			WHERE pai.`id_product_attribute` IN (XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX) AND il.`id_lang` = XX ORDER by i.`position`
12
SELECT *
FROM `ps_cms` a
LEFT JOIN `ps_cms_shop` `c` ON a.`id_cms` = c.`id_cms` AND c.`id_shop` = XX
WHERE (a.`id_cms` = XX) LIMIT XX
Link to comment
Share on other sites

First we install this shop on PHP 7.x and nothing in speed happens :)

So we have dedicated server and MariaDb as a Mysql engine. So if you look at screen you can see problem. As I said there is a bug in PS take a look closer in sql query. Why is a doubles for example in:

 

SELECT SUM(`quantity`)
				FROM `ps_cart_product`
				WHERE `id_product` = XX
				AND `id_cart` = XX LIMIT XX

 

I check "cartpresenter" no have idea why sum of quantity is required in cart on product page. Second thing shop is slow down only when you have product with attributes [in my example 55 colors in only one product]. So I thing that is a bug in PrestaShop 1.7 

Link to comment
Share on other sites

3 hours ago, west28 said:

First we install this shop on PHP 7.x and nothing in speed happens :)

First, your screen shot says PHP 5.4.  And if you enable opcache and actually test the store under load, you will see a huge improvement as compared to PHP 5.4 under load.

4 hours ago, west28 said:

So if you look at screen you can see problem. As I said there is a bug in PS take a look closer in sql query. Why is a doubles for example in:

Could be a bug, perhaps not.  The beauty of open source is that you can change it yourself.  If you don't think the sum of products in the cart is needed somewhere else, then change the query and move on.  However there is likely a sentence in the front office that tells the customer how many products are in the cart, which would be a sum of the quantity from the cart_product table. (so perhaps its used)

Note: The query that you have highlighted would not be affected by the number of products in your store, or the number of product attributes/combinations for a product.  The query only selects data from ps_cart_product, and that table stores only the products that customers have added to their carts. 

SELECT SUM(`quantity`)
				FROM `ps_cart_product`
				WHERE `id_product` = XX
				AND `id_cart` = XX LIMIT XX

So the question to ask is, how many records are in the ps_cart_product table, and what are the indexes on that table?  Have you executed this query using phpmyadmin to confirm how long it takes, or use any tools that would explain the query or analyze the table data?

Link to comment
Share on other sites

Thanks

1. this query takes Showing rows 0 - 0 (1 total, Query took 0.0002 seconds.)  So it is not a problem with server or database or php another query [hard] SELECT SUM(`quantity`) FROM `ps_cart_product` WHERE `id_product` = 46  Showing rows 0 - 0 (1 total, Query took 0.0013 seconds.)  

2 I change cartpresenter to show only sum of products not quantity but nothing in speed happens 

3 Strange is that. When you have empty cart shop work fast. If you add to cart more than 10 products ajax slow down and every action for example change attribute selection takes 5 seconds.  Have you any idea where to look [debug, controller or something else]. 

Regards

 

 

 

 

 

Link to comment
Share on other sites

you provided a query and suggested it was an issue, however you tested using phpmyadmin and proved it is not an issue.  so you just need to continue to step through the code until you find the parts that are functioning poorly

alternatively, if you think it is a bug that is related to product attributes/combinations, then open a forge ticket with reproducible steps to allow Prestashop developers to review.

Link to comment
Share on other sites

  • 1 month later...

Wa are having the same issue ( version 1.7.2.4 ) . After adding more than 10 products the store slows down. At around 30 - it  performs so poorly that I would say it is unusable. Newest version of PHP, fast server etc. It all comes back to normal after you've emptied the basket and gets worse as you add more items into the cart. Anyone, any ideas?

Link to comment
Share on other sites

22 hours ago, cynamonstudio said:

Wa are having the same issue ( version 1.7.2.4 ) . After adding more than 10 products the store slows down. At around 30 - it  performs so poorly that I would say it is unusable. Newest version of PHP, fast server etc. It all comes back to normal after you've emptied the basket and gets worse as you add more items into the cart. Anyone, any ideas?

I would suggest you use PS v1.6 instead

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...
On 2017/11/22 at 2:25 AM, west28 said:

I agree with this:

 

I check Chrome console and here is a screen

image.thumb.png.b964e485bb4b2734500e2cbcd8b93fc9.png

 

Something is wrong with cart module. We have only 30 products and lot of attributes in only one product. The shop slow down when you add more than 5 products to cart. We don't have bugs in modules and debug profile show this:

Load Time 5568 ms - You'd better run your shop on a toaster
Querying Time 663 ms
Queries 1017
Memory Peak Usage 64.5 Mb
Included Files 436 files - 6.73 Mb
PrestaShop Cache 0.01 Mb
Global vars 0.18 Mb
PrestaShop Version 1.7.2.4
PHP Version 5.4.45-0+deb7u11 (OK)
MySQL Version 5.5.58-0+deb7u1 (Consider upgrading)
Memory Limit 2048M
Max Execution Time 1200s
Smarty Cache enabled
Smarty Compilation

never recompile

 

 

doubles:

382

SELECT SUM(`quantity`)
				FROM `ps_cart_product`
				WHERE `id_product` = XX
				AND `id_cart` = XX LIMIT XX

 

68

			SELECT pa.`id_product`, a.`color`, pac.`id_product_attribute`, SUM(IF(stock.`quantity` > XX, XX, XX)) qty, a.`id_attribute`, al.`name`, IF(color = "", a.id_attribute, color) group_by
			FROM `ps_product_attribute` pa
			 INNER JOIN ps_product_attribute_shop product_attribute_shop
        ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = XX) LEFT JOIN ps_stock_available stock
			ON (stock.id_product = `pa`.id_product AND stock.id_product_attribute = IFNULL(`pa`.id_product_attribute, XX) AND stock.id_shop = XX  AND stock.id_shop_group = XX  )
			JOIN `ps_product_attribute_combination` pac ON (pac.`id_product_attribute` = product_attribute_shop.`id_product_attribute`)
			JOIN `ps_attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
			JOIN `ps_attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = XX)
			JOIN `ps_attribute_group` ag ON (a.id_attribute_group = ag.`id_attribute_group`)
			WHERE pa.`id_product` IN (XX) AND ag.`is_color_group` = XX
			GROUP BY pa.`id_product`, a.`id_attribute`, `group_by`
			HAVING qty > XX
			ORDER BY a.`position` ASC;
63

SELECT SUM(quantity)
FROM `ps_stock_available`
WHERE (id_product = XX) AND (id_product_attribute = XX) AND (id_shop = XX) AND (id_shop_group = XX) LIMIT XX
62

			SELECT a.`id_attribute`, a.`id_attribute_group`, al.`name`, agl.`name` as `group`, pa.`reference`, pa.`eanXX`, pa.`isbn`,pa.`upc`
			FROM `ps_attribute` a
			LEFT JOIN `ps_attribute_lang` al
				ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = XX)
			LEFT JOIN `ps_product_attribute_combination` pac
				ON (pac.`id_attribute` = a.`id_attribute`)
			LEFT JOIN `ps_product_attribute` pa
				ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
			 INNER JOIN ps_product_attribute_shop product_attribute_shop
        ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = XX)
			LEFT JOIN `ps_attribute_group_lang` agl
				ON (a.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = XX)
			WHERE pa.`id_product` = XX
				AND pac.`id_product_attribute` = XX
				AND agl.`id_lang` = XX
38

SELECT `id_product_attribute`
			FROM `ps_product_attribute`
			WHERE `id_product` = XX
37

			SELECT image_shop.`cover`, i.`id_image`, il.`legend`, i.`position`
			FROM `ps_image` i
			 INNER JOIN ps_image_shop image_shop
        ON (image_shop.id_image = i.id_image AND image_shop.id_shop = XX)
			LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = XX)
			WHERE i.`id_product` = XX
			ORDER BY `position`
36

			SELECT cd.`id_customization`, c.`id_address_delivery`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`,
				cd.`type`, cd.`index`, cd.`value`, cd.`id_module`, cfl.`name`
			FROM `ps_customized_data` cd
			NATURAL JOIN `ps_customization` c
			LEFT JOIN `ps_customization_field_lang` cfl ON (cfl.id_customization_field = cd.`index` AND id_lang = XX)
			WHERE c.`id_cart` = XX AND c.`in_cart` = XX
			ORDER BY `id_product`, `id_product_attribute`, `type`, `index`
36

                SELECT COUNT(`id_customization`) FROM `ps_cart_product`
                WHERE `id_cart` = XX AND `id_customization` != XX LIMIT XX
32

			SELECT pai.`id_image`, pai.`id_product_attribute`, il.`legend`
			FROM `ps_product_attribute_image` pai
			LEFT JOIN `ps_image_lang` il ON (il.`id_image` = pai.`id_image`)
			LEFT JOIN `ps_image` i ON (i.`id_image` = pai.`id_image`)
			WHERE pai.`id_product_attribute` IN (XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX) AND il.`id_lang` = XX ORDER by i.`position`
12

SELECT *
FROM `ps_cms` a
LEFT JOIN `ps_cms_shop` `c` ON a.`id_cms` = c.`id_cms` AND c.`id_shop` = XX
WHERE (a.`id_cms` = XX) LIMIT XX

it is because of the symfony and the rendering way the prestashop 1.7 uses, I compared the 1.6 and the 1.7 combination selection page at product page, on 1.6 product page ,the html was generated with smarty at the server end and the javascript(jquery) only update combination data(at browser end)  when combination selection changes, but on 1.7,each time when selection change with combinations at product pages, the symfony (with its MVC twig template engine) will request changes with data updates(include the html strcuture) at server, and then renders the changes to the brower end, this is why when the network is worse, then the loading time is slower.

 

the quoted thread picture shows clearly, the longest time is the TTFB waiting time, so rolling back to 1.6 method to update the combination on product page is the ultimate solution to this problem.this is the key factor that I haven't update my shop to 1.7. Hope helps and the prestashop team can give attention to this.

Link to comment
Share on other sites

  • 5 months later...

Hi,

just want to put my mustard in ... I know it is an older thread ...

I had the same issue with "waiting (TTFB)" as shown above at products page ... Card page and payment page.

In my case it was an issue with file system security 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.

 

Edited by [email protected] (see edit history)
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...