Magento 2.3.4
Add the file: app/design/frontend/VENDOR/THEME/Magento_Catalog/layout/catalog_category_view_selectable_[ID]_name.xml
Edit the category in the backend to use the Specifc Layout (Catalog->Categories->Design> Custom Layout Update->select "name" )
Save. I get the message "You saved the category."
Clear cache
Refresh category frontend and category backend
Specific layout changes from the file should be applied
Changes have no effect.
Also in the category backend, Custom Layout Update appears as "No update". So the change is not saved without any error.
Hi @Krapulat. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
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.
@Krapulat do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento give me 2.4-develop instance
Hi @Krapulat. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @Krapulat, here is your Magento instance.
Admin access: https://i-27942-2-4-develop.instances.magento-community.engineering/admin_bfb0
Login: 280cabec Password: 1c814b467a41
Instance will be terminated in up to 3 hours.
The instance can't help because I need to create the file app/design/frontend/VENDOR/THEME/Magento_Catalog/layout/catalog_category_view_selectable_[ID]_name.xml
I can confirm this is occurring as well. It looks like the data is just not being stored on save.
See catalog_category_entity_varchar
@Krapulat
FYI you can manually add the data into the table and the logic will work on the frontend.
I did it with a data patch
` $table = $this->moduleDataSetup->getTable('catalog_category_entity_varchar');
$connection = $this->moduleDataSetup->getConnection();
$data = [
'attribute_id' => YOUR_EAV_ATTRIBUTE_ID,
'store_id' => 0,
'row_id' => CATEGORY_ID,
'value' => 'XmlFileName'
];
$connection->insert($table, $data);
`
hacky but it worked for the time being.
@msyhr I haven't been able to obtain the attribute_id for "Custom Layout Update"
@msyhr I haven't been able to obtain the attribute_id for "Custom Layout Update"
@Krapulat The attribute is called custom_layout_update_file There are two (one for product pages, one for category pages). You can get the ID's from the actual table (eav_attribute).
SELECT * FROM eav_attribute WHERE attribute_code = 'custom_layout_update_file'
You want the ID of the one that has the source model of Magento\Catalog\Model\CategoryAttributeSource\LayoutUpdate
I can override succesfully a layout for CMS page,
---> but for CATEGORY it don't works:
1) Created file "catalog_category_view_selectable_495_uomo.xml" (where "495" is the category ID and "uomo" is the name of the file)
2) located here app/design/frontend/VENDOR/THEME/Magento_Catalog/layout/
3) on backend I can't see any choice on Custom Layout Update, no way.. tryed to switch to production, developer, flushed caches.
@msyhr I've tried but it doesn't work. I inserted directly to the database.
@msyhr I've tried but it doesn't work. I inserted directly to the database.
@Krapulat make sure you're using the correct value for the DB entry (not the entire filename)
For instance, my file catalog_category_view_selectable_1869_OverstockNote.xml
Ends up looking like this in the DB (catalog_category_entity_varchar).

@msyhr
SELECT * FROM eav_attribute WHERE attribute_code = 'custom_layout_update_file'; => attribute_id=815 for "Magento\Catalog\Model\CategoryAttributeBackend\LayoutUpdate"
I have the file catalog_category_view_selectable_26_sub.xml and I see "sub" in the category backend for option "Custom Layout Update". So the file is ok.
And this is the result for "select * from catalog_category_entity_varchar where attribute_id='815';":
+----------+--------------+----------+-----------+-------+
| value_id | attribute_id | store_id | entity_id | value |
+----------+--------------+----------+-----------+-------+
| 13185 | 815 | 0 | 26 | sub |
+----------+--------------+----------+-----------+-------+
But still doesn't work...
@Krapulat I have same problem. Did you get any chance to solve this issue?
Me too.. Anyone found a solution for this BUG?
How it's possible all these bugs on a platform?!
I'm facing the same issue and I can't find the answer. This seems like a big deal and it would be nice if someone had the time to look further into this issue.
Summary of the issue
Custom Layout Update dropdown in backend doesn't show custom layout.
Information on your environment
Magento v2.3.5-p1
PHP 7.3.18
Steps to reproduce
Created a file called "catalog_category_view_selectable_20_WomenCategoryRemoveTitle.xml" under Magento_Catalog in child theme directory with the following content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.wrapper">
<referenceBlock name="breadcrumbs" remove="true"/>
<referenceBlock name="page.main.title" remove="true"/>
</referenceContainer>
</body>
</page>
Expected and actual results
Expected to be able to select the layout in the Custom Layout Update dropdown for category Women (ID:20).
+1 on this issue fresh install
Same issue.
If I place a cms_page_view_selectable_home_LayeredNavigation.xml file under /vendor/magento/theme-frontend-luma/Magento_Catalog/layout/ -- the Custom Layout Update works. But if I place it under my custom theme (with luma as the parent theme), then it doesn't show up in Magento admin.
The select dropdown remains empty. Only "No update" visible. The file isn't recognized when I put it only in my custom theme based on parent theme Luma. I can only get it to work by putting the file in the /vendor/ folder ...
I have exactly the same issue. @john-dhm are you using the Athlete 2 theme?
My setup is exactly the same as @john-dhm and I have been trying everything to get it to work.
@AndrewJGriff It's not theme related.
@john-dhm Did you find a solution? I found that if I set 'Enable single-store mode' to NO, then the Custom Layout Update works, but if i switch this to 'YES' so I have single store mode enabled, then I cannot select the file name in the admin screen.
I am having the same problem, for me with CMS pages.
I'm trying to update alyout of the home CMS Page, I created file :
\[VENDOR]\[THEME]\Magento_Cms\layout\\cms_page_view_selectable_home_NewTest.xml
Flushed the Cache
Edited the "Homepage" home CMS Page, I can see "NewTest" in the selector and when I select it and Save it does save (revisiting CMS page editor later shows the value as saved) however no layout update is being performed, cleared and flushed cache.
Pretty Straight forward proof of concept :
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="main.content">
<block name="mytest"
template="Magento_Theme::test.phtml"
before="-" />
</referenceContainer>
</body>
</page>
@Appmerce Try placing the xml file in Magento_Cms or Magento_Theme. I placed test files in botrh locations nad after Flush they did appear in Admin.
@silversil Can you elaborate On how you got it to work for CMS page?
I.m running 2.3.5-p1 BTW.
If you have the "Custom Layout Update" not showing in the dropdown issue, try changing your scope in the admin panel to the store view (eg change scope from "All Store Views" to your store view.
We just had this issue and changing the scope to store view made the missing custom layout update appear in the dropdown (for category updates).
Hi @Chris-ISN , thanks forthe reply! I don't have that issue (indeed the CM Page was already assigned to a specific view). I am working on CMS Pages not categories (test to follow!) and got the item to appear in the dropdown no problem, it just does not get applied. https://github.com/magento/magento2/issues/28750 describes my issue better (though its not unrelated) so I cross-posted there too.
I spotted @silversil mention _"I can override succesfully a layout for CMS page,"_ so I thought I'd ask here too.
FYI, I'm going to have a crack at debugging this, this morning. feels like it's something like presenting the update handle properly. Like the update is there in the layout but the handle that is called does not match the one in the xml/database or summin. Gonna see if the update XML is actually in the layout first and work from there... Of course will share in both posts what/if I find
Ok, I have debugged and actually solved my issue. I redact my vote on this issue as "not related" now to Layout Updates appearing in admin pertaining to Categories.
FYI, Just in case it's relevant my solution was that it was all to do with an omission on my part inthe xml file.
Once I debugged what update Handles where being called I was able to correct my XML and it worked fine....
\Vendor\Theme\Magento_Cms\layout\cms_page_view_selectable_home_NewTest.xml :
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="cms_page_view_selectable_home_NewTest"/>
<referenceContainer name="main.content">
<block name="mytest"
template="Magento_Theme::test.phtml"
before="-" />
</referenceContainer>
</page>
I was basically missing the update declaration with the right handle name. FYI the handle name is the full name of your file!
same problem,i want to custom home page layout,but failed. I can only write data directly to the database. custom_layout_update_xml or layout_update_xml field.
I think what I realized in debugging is that it does not parse the layout XML in the file when the page is loaded (after a cache flush) but rather, when you save the page it checks if the file exists, parses the layout then and if it's good saves it to the database, it then, on parsing the page on the frontend loads the XML from the database.
Not sure if I'm correct in that, there were alot of hoops while I was debugging a few days ago, I'll be doing some more custom page layouts today so I'll take care to debug it, I think the key is to resave the page if you change the selectable xml file.
Did you have examples @amorr ? It will help the guys above....
my environment
Magento v2.3.5-p1
PHP 7.2.24
i can find my custom layout name in Custom Layout Update, but after save page. nothing changed. I confirmed that my code in xml file is available when in the default.xml.
None of the above is working for me.
For now, my solution is write to cms_page table custom_layout_update_xml or layout_update_xml field like
<referenceContainer name="main.content">
<block name="mytest"
template="Magento_Theme::test.phtml"
before="-" />
</referenceContainer>
I think this was the working mechanism prior to version 2.3.4
Strange, that's exactly the same Magento version as me, I'm on php 7.3. Actually running it on Ubuntu 18 and Windows 10 (dev machines) and it works ok for me.
On review it seems XML is not saved to the database at all on my working version. just layout_update_selected so I guess the XML isn't transported to the DB on Page save (it might still be getting validated?).
I assume your layout file contains the prerequisite and
Did you add the update handle declaration as well?
You're correct prior to 2.3.4 the Custom XML field would save xml as text into this column in the database. I would not rely on injecting XML into that field however as it appears they've simply forgotten to delete it (or not deleted it for compatibility).
Still injecting the XML into the DB works for you so happy days! But I can confirm I was able to get the "new method" working with a well formed xml file and an update handle (with the file in the Magento_Cms theme sub folder)
@magento give me 2.4-develop instance
Hi @chrom. Thank you for your request. I'm working on Magento 2.4-develop instance for you
Hi @chrom, here is your Magento instance.
Admin access: https://i-27942-2-4-develop.instances.magento-community.engineering/admin_d415
Login: 7db9be75 Password: 7e5de3a7bd4e
Instance will be terminated in up to 3 hours.
@Blatant I did a new test and found out what the potential problem is.
i used following custom layout xml content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.wrapper">
<referenceBlock name="breadcrumbs" remove="true"/>
<referenceBlock name="page.main.title" remove="true"/>
</referenceContainer>
</body>
</page>
make a file name cms_page_view_selectable_help-contact_test.xml in vendor/theme/Magento_Cms/layout
flush cache and edit help-contact page design ,select test save it .it's work.
same锛宮ake a file name catalog_category_view_selectable_4_test.xml in vendor/theme/Magento_Catalog/layout,it's wrok too.
then my problem, i make a file named cms_page_view_selectable_home_customHome.xml ,it can not work. but i found www.site.com/home changed.So I guess the question is why it doesn't work on baseurl.
Hey @amorr,
I had the exact same thing, specifically overriding the homepage! Like exactly the same (the layout worked on /home but not on the homepage proper). I have a fix/workaround for that!
I did quite a deep debug of the Layout system, starting at the controllers and logging what happens when the updates are loaded in layout. WHat I found is that the controller in the CMS module for the homepage is not the same as any CMS page, it's not cms_page_view but cms_index_index. you'll note that the controller path is part of the file name. (I'm not that happy that I had to debug to this conclusion from the layout up, it seems obvious in retrospect but I just skipped the fact that the files all begin with module_controller_action)
The workaround is to duplicate your file cms_page_view_selectable_home_customHome.xml file in the same folder with the name cms_index_index_selectable_home_customHome.xml and it'll start working.
It's a real kludgy workaround but basically on the admin your selecting the option cozz of the existence of the cms_page_view file. and when you goto /home it uses that file by looking for :
<module>_<controller>_<action>_selectable_<pageuri>_<OptionName>.xml
When you hit the homepage that pattern above maps to `cms_index_index_selectable_
SO in summary, copy your layout.xml file for your home page, and rename it replacing _page_view with _index_index, remember to update BOTH files! and you will still need to obvs select the right option in the admin.
I've yet to report this bug to Magento, but will do next wek after go live!
@Blatant you're right, It's work!
Magento 2.3.5-p2
Trying to set a custom layout on a CMS page but it's not working because I have 2 themes, one global and one for a specific website. Anything I add to the theme for the specific website gets ignored but it shows up if I add it in the theme set to global.
There's no way to switch store views on the CMS Pages controller either.
Note: This still doesn't work since it only loads the current theme on page load, so you need an empty XML in the default theme and the actual implementation in the website theme.
Yea it's a bit fiddly, the blank parent theme xml and the actual override would work. I think when I looked at the code the dropdown to set it on the CMS page is theme aware, so if you assign your page to Store 2 which is using "ChildTheme" and save when it reloads it will load your child theme specific XML for setting it, but then you have 2 identical CMS pages, one for the stores using the child and one for the stores using the parent.
Worth noting though, apart from the "getting options from file names and loading xml from file on layout it functions just like the old "Layout Update XML" box on the CMS page. That too is not settable by child theme, you would need to dupe your page to have 2 different (one blank) layout update XML fields.
Defo needs some improvement, including allowing the layout on the CMS page that is being used for the homepage without duping files, and as you mention more concise method of applying update at theme/store level.
@john-dhm Did you get any chance to solve the issue? Would you share your solution please?
Still having to add these to the database for categories. Even if these are added to the database, they do not show in the dropdown menu as selected. Standard M2 install on 2.3.5-p2
What about Category page. its not working also on category? Any workaround for this.
I got it working for Category Pages...
I've implemented a custom layout on the parent/default theme in the directory [theme_dir]/Magento_Catalog/layout/, with the filename catalog_category_view_selectable_28_OverrideCat28.xml, "OverrideCat28" appears in the override dropdown and it obviously affects Category ID 28.
The xml file is complex but the crucial elements are :
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="catalog_category_view"/>
<!-- head, refernceBlock, referenceContainer, container, block, ect -->
</page>
If I recall its not to FPC friendly either so hit the caches after applying or editing
M2.3.4-p1
Most helpful comment
Hey @amorr,
I had the exact same thing, specifically overriding the homepage! Like exactly the same (the layout worked on
/homebut not on the homepage proper). I have a fix/workaround for that!I did quite a deep debug of the Layout system, starting at the controllers and logging what happens when the updates are loaded in layout. WHat I found is that the controller in the CMS module for the homepage is not the same as any CMS page, it's not
cms_page_viewbutcms_index_index. you'll note that the controller path is part of the file name. (I'm not that happy that I had to debug to this conclusion from the layout up, it seems obvious in retrospect but I just skipped the fact that the files all begin with module_controller_action)The workaround is to duplicate your file
cms_page_view_selectable_home_customHome.xmlfile in the same folder with the namecms_index_index_selectable_home_customHome.xmland it'll start working.It's a real kludgy workaround but basically on the admin your selecting the option cozz of the existence of the
_.xml and thats what Magento looks for. everything else about the page object is the same, the CMS Page URI, the options saved in the DB thats loaded and all that, but becasue the homepage proper uses a different controller id doesn't find the "actual" XML file, but it will find your craftily placed and named duplicate!
cms_page_viewfile. and when you goto/homeit uses that file by looking for :<module>_<controller>_<action>_selectable_<pageuri>_<OptionName>.xmlWhen you hit the homepage that pattern above maps to `cms_index_index_selectable_
SO in summary, copy your layout.xml file for your
homepage, and rename it replacing_page_viewwith_index_index, remember to update BOTH files! and you will still need to obvs select the right option in the admin.I've yet to report this bug to Magento, but will do next wek after go live!