magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Product layout based on attribute_set

Open in-session opened this issue 3 years ago • 18 comments

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.

in-session avatar Oct 05 '22 06:10 in-session

@magento run all tests

in-session avatar Oct 05 '22 06:10 in-session

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:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic 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

m2-assistant[bot] avatar Oct 05 '22 06:10 m2-assistant[bot]

@magento run all tests

in-session avatar Oct 05 '22 06:10 in-session

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

in-session avatar Oct 06 '22 05:10 in-session

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

in-session avatar Oct 07 '22 06:10 in-session

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

in-session avatar Oct 09 '22 07:10 in-session

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

in-session avatar Oct 11 '22 19:10 in-session

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

in-session avatar Oct 13 '22 19:10 in-session

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

in-session avatar Oct 14 '22 06:10 in-session

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

engcom-Hotel avatar May 31 '24 07:05 engcom-Hotel

@magento create issue

engcom-Echo avatar Jun 04 '24 10:06 engcom-Echo

@magento run all tests

engcom-November avatar Jun 07 '24 08:06 engcom-November

Hello @in-session,

Thank you for the collaboration & contribution!

✔️ QA Passed

Steps to reproduce:

  1. Create a xml file catalog_product_view_attribute_set_{id}.xml inside app/design/frontend/<vendor>/<module>/Magento Catalog/layout/.
  2. Add desired configuration in the newly created xml file.
  3. Clear cache.
  4. 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 1 and Test product 2 have attribute set id 4.
  • Created a catalog_product_view_attribute_set_4.xml to move the product.info.social element after product.info.price.
  • Layout of both the products with attribute set id 4 has been changed.

image image

Thank you.

engcom-November avatar Jun 07 '24 08:06 engcom-November

Since the builds are failing moving this to Extended Testing.

engcom-November avatar Jun 07 '24 12:06 engcom-November

@magento run all tests

engcom-November avatar Jun 10 '24 06:06 engcom-November

@magento run Functional Tests B2B, Functional Tests EE, Integration Tests, WebAPI Tests

engcom-November avatar Jun 10 '24 08:06 engcom-November

Repeating failure in Functional Tests B2B and EE are flaky and are known issues.

Functional Tests B2B: 1st Run: image

2nd Run: image

Known issues: ACQE-6648 - StorefrontUpdateCustomerAddressBelgiumTest ACQE-6523 - AdminReorderWithCatalogPriceRuleDiscountTest ACQE-6350 - AdminCreateDraftQuoteFromQuoteGridPageWithMultipleStoresTest ACQE-6321 - StoreFrontAddOutOfStockProductToShoppingCartTest

Functional Tests EE 1st Run: image

2nd Run: image

Known issues: ACQE-6523 - AdminReorderWithCatalogPriceRuleDiscountTest ACQE-6331 - StorefrontCreateOrderAllQuantityGroupedProductOptionDefaultStockTest

engcom-November avatar Jun 10 '24 11:06 engcom-November

Repeating WebAPI Tests are flaky and are known issues.

1st Run: image

2nd Run: image

Known issues: AC-11750 - testGetCustomerDescendingSortedOrders

Hence moving to Merge in Progress.

engcom-November avatar Jun 10 '24 11:06 engcom-November

As the linked issue is marked as feature request, moving the PR to On hold till we get PO confirmation.

Thank you.

engcom-November avatar Jun 10 '24 11:06 engcom-November

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...

MaximGns avatar Jul 16 '24 14:07 MaximGns

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.

toonvd avatar Aug 02 '24 12:08 toonvd