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
Method chaining broken by refactor in Module_Catalog Product Collection #24964
Comments
Hi @abdulmueid. 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. @abdulmueid do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
I think that's critical. After update to 2.3.3 exception with porto theme PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Catalog\Model\ResourceModel\Product\Collection::addIsSaleableAttributeToFilter() |
@electroidru that error is a related but separate problem. The new method signatures type check condition parameter for nullable array whereas the calling method This breaks a number of popular themes (Porto, Market) and modules which filter products. We can open another issue for this behavior. I'm still debugging and checking for all the misbehaviours. |
Hi @maheshWebkul721. Thank you for working on this issue.
|
@shikhamis11 Please look in to this, and confirm this issue. This issue is reproducible. |
Hi @shikhamis11. Thank you for working on this issue.
|
Hello @abdulmueid
yes you are right Please make Pull request with it's solution |
@shikhamis11 Thank you for verifying the issue. Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:
Once all required information is added, please add label |
✅ Confirmed by @shikhamis11 Issue Available: @shikhamis11, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
Hi @shikhamis11. Thank you for working on this issue.
|
@shikhamis11 Thanks for verifying this issue. @magento i am working on it. |
Hi @abdulmueid, @shikhamis11, @maheshWebkul721. Thank you for your report and collaboration! The issue was fixed by Magento team. The fix will be available with the upcoming |
You should contact your theme developer and ask them for the updated patch for Magento 2.3.3 if you using Porto theme follow this link: https://magento2expert.com/error-after-indexing-after-upgrade-to-magento-2-3-3-porto-theme/ |
The commit a77fd52 refactors the method
addAttributeToFilter
in fileapp/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
by adding two new methodsaddIsSaleableAttributeToFilter
andaddTierPriceAttributeToFilter
.However, there are missing return statements in the
if
statement which break method chaining. https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php#L1591-L1597Preconditions (*)
Steps to reproduce (*)
addAttributeToFilter
with attributeis_saleable
addAttributeToFilter
with any other attribute to chain the functionExpected result (*)
Actual result (*)
addAttributeToFilter
returns null when addingis_saleable
to filter, therefore breaking method chainingThe text was updated successfully, but these errors were encountered: