magento2
magento2 copied to clipboard
Product layout based on attribute_set
Currently there is only the possibility to adjust the layout by SKU or by types of the product. In most productive cases, however, this is only partly practical. because it then only refers to many articles or one article. With the integration the layout can be used based on the attribute set similar to an article group, which is more needed in most cases. The display of the articles are controlled in the backend by attribute_set, so there should be a way to pass this to the frontend store as well.
https://developer.adobe.com/commerce/frontend-core/guide/layouts/product-layouts/
| LAYOUT FILE | DESCRIPTION |
|---|---|
| catalog_product_view.xml | Common layout. Affects all product types |
| catalog_product_view_type_bundle.xml | Layout from this file is applied to bundle product only |
| catalog_product_view_type_configurable.xml | Layout from this file is applied to configurable product only |
| catalog_product_view_type_downloadable.xml | Layout from this file is applied to downloadable product only |
| catalog_product_view_type_grouped.xml | Layout from this file is applied to grouped product only |
| catalog_product_view_type_simple.xml | Layout from this file is applied to simple product only |
| catalog_product_view_type_virtual.xml | Layout from this file is applied to virtual product only |
| catalog_product_view_id_{id}.xml | Layout from this file is applied to the specific product by Entity ID value. E.g. catalog_product_view_id_45.xml |
| catalog_product_view_attribute_set_{id}.xml | Layout from this file is applied to the specific product attribute set by Entity ID value. E.g. catalog_product_view_attribute_set_45.xml |
| catalog_product_view_sku_{sku}.xml | Layout from this file is applied to the specific product by SKU value. E.g. catalog_product_view_sku_24-WG080.xml |
Example: catalog_product_view_attribute_set_15.xml Controls the front-end display of all items that are within the Bags group.
@magento run all tests
Hi @in-session. Thank you for your contribution Here are some useful tips how you can test your changes using Magento test environment. Add the comment under your pull request to deploy test or vanilla Magento instance:
@magento give me test instance- deploy test instance based on PR changes@magento give me 2.4-develop instance- deploy vanilla Magento instance
:exclamation: Automated tests can be triggered manually with an appropriate comment:
@magento run all tests- run or re-run all required tests against the PR changes@magento run <test-build(s)>- run or re-run specific test build(s) For example:@magento run Unit Tests
<test-build(s)> is a comma-separated list of build names. Allowed build names are:
Database CompareFunctional Tests CEFunctional Tests EE,Functional Tests B2BIntegration TestsMagento Health IndexSample Data Tests CESample Data Tests EESample Data Tests B2BStatic TestsUnit TestsWebAPI TestsSemantic Version Checker
You can find more information about the builds here
:information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.
For more details, review the Magento Contributor Guide documentation.
:warning: According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of Pull Requests 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.
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento give me 2.4-develop instance
Hi @in-session. Thank you for your request. I'm working on Magento instance for you.
Hi @in-session, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Functional Tests B2B,Functional Tests CE,Functional Tests EE,Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run all tests
@magento create issue
@magento run all tests
Hello @in-session,
Thank you for the collaboration & contribution!
✔️ QA Passed
Steps to reproduce:
- Create a xml file
catalog_product_view_attribute_set_{id}.xmlinsideapp/design/frontend/<vendor>/<module>/Magento Catalog/layout/. - Add desired configuration in the newly created xml file.
- Clear cache.
- Check in the frontend whether the changes been applied to the products of that particular attribute set.
Before: ✖️ Unable to change the layout of all the products that has the same attribute set.
After: ✔️ Able to change the layout of all the products that has the same attribute set.
- Here
Test product 1andTest product 2have attribute set id 4. - Created a
catalog_product_view_attribute_set_4.xmlto move theproduct.info.socialelement afterproduct.info.price. - Layout of both the products with attribute set id 4 has been changed.
Thank you.
Since the builds are failing moving this to Extended Testing.
@magento run all tests
@magento run Functional Tests B2B, Functional Tests EE, Integration Tests, WebAPI Tests
Repeating failure in Functional Tests B2B and EE are flaky and are known issues.
Functional Tests B2B:
1st Run:
2nd Run:
Known issues: ACQE-6648 - StorefrontUpdateCustomerAddressBelgiumTest ACQE-6523 - AdminReorderWithCatalogPriceRuleDiscountTest ACQE-6350 - AdminCreateDraftQuoteFromQuoteGridPageWithMultipleStoresTest ACQE-6321 - StoreFrontAddOutOfStockProductToShoppingCartTest
Functional Tests EE
1st Run:
2nd Run:
Known issues: ACQE-6523 - AdminReorderWithCatalogPriceRuleDiscountTest ACQE-6331 - StorefrontCreateOrderAllQuantityGroupedProductOptionDefaultStockTest
Repeating WebAPI Tests are flaky and are known issues.
1st Run:
2nd Run:
Known issues: AC-11750 - testGetCustomerDescendingSortedOrders
Hence moving to Merge in Progress.
As the linked issue is marked as feature request, moving the PR to On hold till we get PO confirmation.
Thank you.
Can this field be configurable? As the existing layout handle for sku/id based is already increasing the load on the layout cache...
Please see: https://github.com/magento/magento2/issues/102#issuecomment-826058850 This change can only cause it to increase it even further...
RIP cache performance. This and the sku/id layout handle should indeed be off by default and have a field in sysconfig to activate it.