You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A customer created a bigger cart with 84 products inside the cart. In the card module the list was rendered fast as expected. Inside the checkout process the whole checkout slowed down. After checking the code a bit it seems that the Standard::getPrice() function is called a lot of times.
Inside the cart the function is called the same amount as in the checkout process (10 Products are producing 248 calls of the Standard::getPrice() function).
I think the problem is that in the cart the price is only fetched once from the database and in all other collections the price is fetched everytime the Standard::getPrice() function is called.
I would suggest to cache also the other prices of collections inside the product object. For testing I created something like this:
if I remember correctly there were reasons not to cache the price, mostly because the checkout process can affect it. That's gonna be difficult to debug, but if you could come up with a draft that would be great! 😊
A customer created a bigger cart with 84 products inside the cart. In the card module the list was rendered fast as expected. Inside the checkout process the whole checkout slowed down. After checking the code a bit it seems that the
Standard::getPrice()
function is called a lot of times.Inside the cart the function is called the same amount as in the checkout process (10 Products are producing 248 calls of the
Standard::getPrice()
function).I think the problem is that in the cart the price is only fetched once from the database and in all other collections the price is fetched everytime the
Standard::getPrice()
function is called.I would suggest to cache also the other prices of collections inside the product object. For testing I created something like this:
If you are fine with this, I could create a PR for this.
The text was updated successfully, but these errors were encountered: