-
Notifications
You must be signed in to change notification settings - Fork 9.4k
2.3.4: Update "Custom Layout Update" doesn't work #27942
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 @Krapulat. Thank you for your report.
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:
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. |
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 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');
` hacky but it worked for the time being. |
@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\Category\Attribute\Source\LayoutUpdate |
I can override succesfully a layout for CMS page, ---> but for CATEGORY it don't works:
|
@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). |
SELECT * FROM eav_attribute WHERE attribute_code = 'custom_layout_update_file'; => attribute_id=815 for "Magento\Catalog\Model\Category\Attribute\Backend\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';": 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 Information on your environment Steps to reproduce Expected and actual results |
+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 ... |
@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.
@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. |
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. #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.
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 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
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 I assume your layout file contains the prerequisite <?xml /> 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) |
Hey @amorr, I had the exact same thing, specifically overriding the homepage! Like exactly the same (the layout worked on 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 The workaround is to duplicate your file It's a real kludgy workaround but basically on the admin your selecting the option cozz of the existence of the SO in summary, copy your layout.xml file for your 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 The xml file is complex but the crucial elements are :
If I recall its not to FPC friendly either so hit the caches after applying or editing M2.3.4-p1 |
Hi @engcom-Alfa. Thank you for working on this issue.
|
Hi @Krapulat . Thank you for your report! Unfortunately, we are not able to reproduce the issue on fresh 2.4-develop. Everything works as expected. Manual testing scenario:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="breadcrumbs" remove="true" />
</body>
</page>
Actual Result: ✔️ Breadcrumb is displayed
Actual Result: ✔️ Specific layout changes are applied (Breadcrumb is removed) @Krapulat Are you able to reproduce this issue on clean 2.4-develop? |
I do not understand why, when it is clear this issue is related to Magento 2.3.4, you are trying reproduce this issue using the 2.4-develop branch. Perhaps try and reproduce using 2.3.6? |
@engcom-Alfa thanks. So how do you make a pull request for the 2.3.7 branch to be released in Q2 of this year? (Ref:https://devdocs.magento.com/guides/v2.3/release-notes/open-source-2-3-6.html) |
@pixel-paul Information from Magentp-DevBlog. |
@engcom-Alfa thank you for this additional information, I can see that there has been a major shift in the way Magento 2 is now released. Is there a plan to create an LTS version of Magento 2? |
@pixel-paul I'm sorry, but I don't have this information. |
Hi @Krapulat we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue. |
Check if you don't have a space after the extension .xml this fixed it for me |
Pozdravljeni,
do ponedeljka, 22. marec sem odsoten v tujini, z omejenim dostopom do interneta in telefona. Na va�e sporočilo bom odgovoril z zamikom, takoj ko bom lahko.
Za izredne zaeve me nadome�ča Bojan Kraut
telefon: +386 2 33 242 00
mobitel: +386 31 302 782
email: ***@***.***
Hvala za razumevanje in lep pozdrav.
Anze Voh
…--------------
Hello,
until Monday, 22th march, I'm away with limited internet and phone access. I will reply to your message with a delay as soon as I can.
For emergency situation my replacement is msc. Bojan Kraut
telephone: +386 2 33 242 00
mobile: +386 31 302 782
email: ***@***.***
Thanks for your understanding and best regards.
Anze Voh
--------------
|
Preconditions (*)
Magento 2.3.4
Steps to reproduce (*)
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
Expected result (*)
Specific layout changes from the file should be applied
Actual result (*)
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.
The text was updated successfully, but these errors were encountered: