Magento2: Make Custom Layout Update file selectable generally available in all categories, products and cms pages.

Created on 17 Feb 2020  路  5Comments  路  Source: magento/magento2

Description (*)

Currently in version 2.3.4 Custom Layout Update has been removed to improve security which is great. But to add an update you have to create a xml file in relevant theme directory Magento_Cms, Magento_Catalog using this termination:

catalog_category_view_selectable_<Category ID>_<Layout Update Name>.xml
catalog_product_view_selectable_<Product SKU>_<Layout Update Name>.xml
cms_page_view_selectable_<CMS Page Identifier>_<Layout Update Name>.xml

a) I tried this feature in using this termination "cms_page_view_selectable_mylandingpage_custom.xml"

b) It would be nice if we declare a file with custom layout update and it is generally available to be selected in all pages, categories and products.

Expected behavior (*)

a) Update Dev Docs to make it clear in which folder files have to be saved. => Magento_Cms for pages and Magento_Catalog for categories and products.
b) Have custom layout updates generally available for all pages, categories and products, so user can select and update layout without creating many files with same code over and over. For example:

catalog_category_view_selectable_<All Categories>_<Layout Update Name 1>.xml
catalog_category_view_selectable_<All Categories>_<Layout Update Name 2>.xml
cms_page_view_selectable_<All CMS Pages>_<Layout Update Name 1>.xml
cms_page_view_selectable_<All CMS Pages>_<Layout Update Name 2>.xml

and keep the current feature which is also great

Benefits

=> I think it would improve usability. Users can have a generally available custom layout update and specific available custom layout updates

Additional information

It would save time if user wants only to repeat an already made custom layout update.

ready for confirmation P2 ready for grooming Reported on 2.3.4 S2 feature request

Most helpful comment

Is there anything news on this topic?

At least it would then be possible to output basically different layouts in the frontend, I think this would even be very important.

catalog_product_view_selectable_<All Products Pages>_<Layout Update Name 1>.xml
catalog_product_view_selectable_<All Products Pages>_<Layout Update Name 2>.xml

All 5 comments

Hi @gcampedelli. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

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:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@gcampedelli do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@sdzhepa Please, move this issue to the appropriate feature request repo.

Thank you

Is there anything news on this topic?

At least it would then be possible to output basically different layouts in the frontend, I think this would even be very important.

catalog_product_view_selectable_<All Products Pages>_<Layout Update Name 1>.xml
catalog_product_view_selectable_<All Products Pages>_<Layout Update Name 2>.xml

Any news on this. The ability to have reusable layout updates for category, product and cms pages would be extremely useful

At least it would then be possible to output basically different layouts in the frontend, I think this would even be very important.

catalog_product_view_selectable_<All Products Pages>_<Layout Update Name 1>.xml
catalog_product_view_selectable_<All Products Pages>_<Layout Update Name 2>.xml

In fact, I think it would make more sense to show these not for all products, but for the individual product types.

catalog_product_view_type_<type>_selectable_<Layout Name>.xml

Example:

catalog_product_view_type_bundle_selectable_Layout1.xml
catalog_product_view_type_bundle_selectable_Layout2.xml

Benefits
This has the advantage that a simple layout update can be made on all types. This would give you a global layout for all products and you could also adapt it directly to the type.

catalog_product_view_type_single_selectable_Layout1.xml
catalog_product_view_type_configurable_selectable_Layout1.xml
catalog_product_view_type_grouped_selectable_Layout1.xml
catalog_product_view_type_bundle_selectable_Layout1.xml
catalog_product_view_type_virtual_selectable_Layout1.xml
catalog_product_view_type_downloadable_selectable_Layout1.xml
Was this page helpful?
0 / 5 - 0 ratings