-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Why do we need parent identities on frontend? #35546
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
Comments
Hi @madonzy. Thank you for your report.
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
For more details, review the Magento Contributor Assistant documentation. Add a comment to assign the issue: To learn more about issue processing workflow, refer to the Code Contributions.
🕙 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, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hello @madonzy, Thanks for the reporting and collaboration! We request you to more elaborate on the issue so that we can reproduce it. Please provide us the below information:
Thanks |
Quoting from @sivaschenko's remark in another thread:
For example, when a child product becomes out of stock or back in stock or is being enabled/disabled, it might influence how the parent product is being displayed on the frontend. Does that answer your question @madonzy? |
@hostep not really. When child products become out of stock or enabled/disabled then child product cache tags are purged, and that means the cache of the category page will be purged. There's nothing to do with parent product in your examples. |
I think I start to see your point, trying to fetch the parent products on the frontend makes not so much sense. But the So if there is a performance problem here, it's that these lines should not be executed on the frontend, am I understanding this correctly? |
@hostep yeap. I think just disabling the plugin in the frontend scope di.xml will be a clean solution. |
@hostep thanks for helping us in understanding the issue. Hello @madonzy, We have looked into the code written here and tried to reproduce the issue by the following way:
In the next scenario we have tried to check the performance of the page by enabling and disabling the plugin and we have seen the below difference in them. Please have a look at the below screenshot: With Plugin:Without PluginI just need to confirm if we are on the correct path or if we can reproduce the issue in some other way. Thanks |
@engcom-Hotel first of all it's totally strange that you did not get the parent product id from the child product. The second is that you measure not only the request but everything that is not needed :) Make sure that P.S: Also, make sure you do not use any cache like Varnish or Built-in FPC in front |
Thanks @madonzy for the quick response. Let me try this and get back to you. :-) |
Hello @madonzy, We have tried to reproduce the issue by searching for a configurable product in the frontend like Instead, If I can get the Child id i.e. Thanks |
If I'm not mistaken, you need to find a simple product on the frontend which is also a child of a configurable product and that simple product needs to be marked as Visible so it shows up on the frontend. You'd probably be better of when setting up your own product data instead of using the sample data, it's going to be easier to test I think... |
Hello @hostep, I have tried this as well. But still, the issue is not reproducible for us. We have followed the below steps:
CompressedScreenRecording2022-06-08at8.40.05.PM.mp4Let us know in case we have missed anything. Thanks |
Hmm, I'm getting confused, just tried understanding the code again:
So uhm, I'm confused now, since when can configurable products in Magento have parents? @madonzy: what do you make of this? Do you have a case where a configurable product has parent products somehow (is this possible with grouped or bundled products maybe, I don't think so...)? |
There's a method that is called on product listing: \Magento\Catalog\Block\Product\ListProduct::getIdentities There is a loop you can see fetching the identities of all products and merging it. Just make sure this method is called and all product are loaded. |
Yes, but that's expected I think, otherwise the caching system in Magento can't invalidate such pages in case one of the products displayed on them gets changed. |
@hostep You can archive this behavior by setting all the configurable product "Visible" attribute to be "Not Visible Individually" and you set the simple product "Visible" attribute to be "Catalog, Search". Then you'll see an unneeded performance impact. |
That's really strange, because the return in these three lines of code will trigger when it's a simple product. So this should not cause performance problems. The code further in the method will only trigger when a configurable product is being loaded on the frontend and will try to load parents of the configurable product, which makes not much sense to me. Have you already debugged this piece of a code a bit yourself? Does the code make sense why and how it triggers in your specific case? |
@hostep first of all, that is a new version, there's no such if in 2.3.6 for example https://github.com/magento/magento2/blob/2.3.6/app/code/Magento/ConfigurableProduct/Model/Plugin/ProductIdentitiesExtender.php Also, I do not really understand the sense of that if statement... If the product is configurable then it will never have a parent product,(method getParentIdsByChild will always return an empty array) so what is the purpose of that plugin? |
Ah this is the first time you mention your Magento version (please next time do this in the opening post, it will make issue handling faster 😉 ) Indeed, the code in 2.3.6 is very different, it was changed significantly in #30746 (which got included in Magento 2.4.2 and higher) As to why the plugin still exists, I have no idea, either it can be thrown away, or a bug was introduced in #30746, it's hard to say. @engcom-Echo or @viktorpetryk: do you guys remember something about that Pull Request? |
Hello @madonzy, It seems the issue has been fixed in the latest development branch i.e. 2.4-develop. Shall we close this issue? Thanks |
@engcom-Hotel shell we remove that plugin at so? |
There's a discussion about this going on in Slack: So it's being looked into I hope 🙂 |
Hello @madonzy, We are confirming this issue as per the below comments: #35546 (comment) We can remove this plugin from here as it is not in use. Thanks |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-6469 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue. |
It's likely the same funny code in "add_bundle_parent_identities" plugin |
@hostep @madonzy I was trying to remove the plugin via custom module <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\Product">
<plugin name="product_identities_extender" disabled="true" />
</type>
</config> My module has these sequence
but the plugin is still enabled if I check with Any idea? |
I've noticed that we have plugin
\Magento\ConfigurableProduct\Model\Plugin\ProductIdentitiesExtender::afterGetIdentities
that is responsible to add parent tags for each child product. For example, that makes the product listing page much slower because we need to load the parent for each product on the page.Why do we really need that on frontend? I tested and it PURGE cache for all child products when configurable product is saved.
The text was updated successfully, but these errors were encountered: