-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Breaking BC changes in the product list block #32268
Comments
Hi @tzyganu. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
✅ Confirmed by @gabrieldagama Issue Available: @gabrieldagama, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
So i was researching a problem with a template i'm using on one of my clients websites, and after some time i figured out it was this exact problem. The issue was that after upgrading to Magento 2.4.0 the pager seemed to do nothing anymore. It just did not work. It just loaded all products that are added to the category. You could see the pagination, you could click on the pages, but the products shown was always the same: All of them. So i found out that this template has a affiliate marketing template in it, which loads the current loaded product collection via the function described. Once I removed that part, the pagination and everything started to function as normal again. Then i went on Google and started looking into this and found out this post on Git. Thanks a lot! Question remains, is this patched in any recent version yet or is it still only available in the 2.4-develop branch? Is there a different way to patch this in? I know i can override core files but i don't really see that as a solution. Could bring up problems in the future. |
I can see that the code from #32390 is included in Magento 2.4.4-beta4, so expect this to become available in 2.4.4 once it gets released in about a month. @rickbakker: take a look at either https://github.com/cweagans/composer-patches or https://github.com/vaimo/composer-patches/ and this documentation around custom patches, those might help you further 🙂 |
Hi @rickbakker , out of curiosity what was that "affiliate marketing template" ? I am facing very same problem with loading all of the products when ever I touch the collection in any level. |
Summary (*)
The
\Magento\Catalog\Block\Product\ListProduct::getLoadedProductCollection
is breaking BC (feel free to challenge it) in the 2.4 version.In 2.4 the method looks like this:
In 2.3 and before it looked like this:
The collection iteration inside the method in 2.4 causes the collection to load the db data so any after plugin or around plugin that calls the original method and tries to affect the collection does nothing to it in 2.4.
Examples (*)
Let's consider this plugin.
In 2.3 and before, this would cause the product list to filter only products that have the value
some_value
for the attribute with codesome_attribute_code
(beside the default filters).In 2.4 this filter has no effect because the collection is already loaded when adding the filter.
Proposed solution
Move the assign operation of category ids to products to the
_beforeToHtml
method in the same class afterPlease provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: