New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve cart performance #32058
base: 8.1.x
Are you sure you want to change the base?
Improve cart performance #32058
Conversation
Hello @MattKelvin! This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community! |
Hi, thanks for this contribution! I found some issues with the Pull Request description:
Would you mind having a look at it? This will help us understand how interesting your contribution is, thank you very much! About linked issuesPlease consider opening an issue before submitting a Pull Request:
(Note: this is an automated message, but answering it will reach a real human) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's my first PR, I tried to do my best but let me know if I did something wrong. What do you think of this change ?
Thank you :)
You did great, thanks to you 👍
Just to be sure, this is a bug fix or a performance improvement?
The way I understand your description: the performance is suboptimal because of this bug, but it didn't break any software behavior or calculation, am I right?
For me it's a bug fix but I dug more and my PR break application of specific price here 😭 https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/Product.php#L3762 Can I update this PR when I think I have a good fix or should I open a new one ? Thank you :) |
If you want you can put your PR as draft, add a new commit, and then change the status to make it reviewable 😉 |
906a9f3
to
d548f7f
Compare
Hello hello ! So I tried to improve this PR. What we need : the quantity per product without taking care of the combinations in order to allow the application (or not) of the specific price. What I think : we already have this information when we get the products in Product->getProducts() and that we just have to group the quantity per id_product. I don't know why we needed the retieve the quantity here (https://github.com/PrestaShop/PrestaShop/pull/32058/files#diff-2af4b21c1e4a7fa69015d9f74895abe3135c783d4ad2b87913f754b49ae5106bL326). Because if the quantity doesn't match the quantity present in rowData, is not normal.. But I think we could kept this code and use ($this->cacheAdapter->retrieve($cacheId) != (int) $cartQuantity) instead of ($cartQuantity = $this->cacheAdapter->retrieve($cacheId) != (int) $quantity) and the cache should do its job properly. |
Hello @MattKelvin There are some issues with your PR after recent commits because automatic tests failed. Almost everything related to shopping cart fails, I think you have a typo in your code the |
d548f7f
to
5e2cff0
Compare
Hi @kpodemski Thank you ! Are you sure ? I think I had to fix something else. Now I'am waiting for the tests 🤞 |
Hello ! Can someone tell me what to do with that ? :D |
quantity
) FROMps_cart_product
WHEREid_product
= XX ANDid_cart
= XX LIMIT XX". Now go on my branch, refresh the profiler the sql queries should be better (around 250)Hello,
It's my first PR, I tried to do my best but let me know if I did something wrong. What do you think of this change ?
Thank you :)