Skip to content

Custom update layout XML not applied to product page in 2.3.5-p1 #28750

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

Closed
1 of 5 tasks
kardi31 opened this issue Jun 17, 2020 · 6 comments
Closed
1 of 5 tasks

Custom update layout XML not applied to product page in 2.3.5-p1 #28750

kardi31 opened this issue Jun 17, 2020 · 6 comments
Assignees
Labels
Issue: ready for confirmation not-confirmed Use for Issue that was closed during confirmation Reported on 2.3.5-p1 Indicates original Magento version for the Issue report.

Comments

@kardi31
Copy link

kardi31 commented Jun 17, 2020

Preconditions (*)

2.3.5-p1

Steps to reproduce (*)

  1. Create product view layout file app/code/{Namespace}/{Module}/view/frontend/layout/catalog_product_view_selectable_{productIdentifier}_removebreadcrumbs.xml with content <referenceBlock name="breadcrumbs" remove="true" />
  2. Go to product page in admin panel, in design section apply removebreadcrumbs custom layout update.
  3. Go to product page on frontend

Expected result (*)

Breadcrumbs from product page should be removed

Actual result (*)

Breadcrumbs are still visible on product page.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Jun 17, 2020

Hi @kardi31. 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.

Please, add a comment to assign the issue: @magento I am working on this


@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jun 17, 2020
@Blatant
Copy link

Blatant commented Aug 6, 2020

Same for me .

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>

@Blatant
Copy link

Blatant commented Aug 7, 2020

I actually solved my issue, posting here in case it helps....
For me I had missed the <update handle="" /> declaration in my XML file....
This example works 100% for me :

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

FYI the handle name is the full name of your file!

@Blatant
Copy link

Blatant commented Aug 12, 2020

I wanted to add a little update to the above for CMS pages.

Firstly, you can use any update handle that's available, it doesn't have to be the file name. This mightbe obvious but I wanted to explicitly declare it. For example default or cms_page_view work just as well.

Second, turns out the homepage ignores Layout Updates, because it generates from a different controller (cms_index_index not cms_page_view"), while Layout is aware of this (and adds extra update handles) the file loader for the layout files is not!

To fix it, copy your layout file and rename from cms_page_view to cms_index_index. You will have to update layout in 2 places, and do not change the page ID or the Layout name on the file!. Make sure you use a handle that is present on both homepage and CMS page view (like default or cms_page_view).

Example :
Vendor\Theme\Magento_CMS\layout\cms_page_view_selectable_home_MyHomeLayout.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"/>
    <referenceContainer name="main">
        <!-- Home - Store Locator -->
        <block name="block.test" before="-" template="testblock.phtml"/>
    </referenceContainer>
</page>

Copy to : Vendor\Theme\Magento_CMS\layout\cms_index_index_selectable_home_MyHomeLayout.xml
(Same file as above)

@ghost ghost added Issue: ready for confirmation and removed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Oct 21, 2020
@magento-engcom-team magento-engcom-team added the Reported on 2.3.5-p1 Indicates original Magento version for the Issue report. label Nov 13, 2020
@engcom-Alfa engcom-Alfa self-assigned this Jan 14, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jan 14, 2021

Hi @engcom-Alfa. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Alfa
Copy link
Contributor

Hi @kardi31. Thank you for your report!

Unfortunately, we are not able to reproduce the issue on fresh 2.4-develop. Looks like the problem has already been fixed.

Manual testing scenario:

  1. Create simple product ("test" for ex.);
  2. Create product view layout file app/code/{Namespace}/{Module}/view/frontend/layout/catalog_product_view_selectable_{productIdentifier "test" in our case}_removebreadcrumbs.xml with 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>
        <referenceBlock name="breadcrumbs" remove="true"/>
    </body>
</page>
  1. Go to the product page in the admin panel, in the design section, apply removebreadcrumbs custom layout update.
  2. Go to the product page on frontend;

Actual Result: ✔️ Breadcrumbs from the product page are removed

Screenshot from 2021-01-14 15-32-24

So, we have to close it.
Please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines
if you are still facing this issue on the latest 2.4-develop branch. Thank you for collaboration.

@engcom-Alfa engcom-Alfa added the not-confirmed Use for Issue that was closed during confirmation label Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: ready for confirmation not-confirmed Use for Issue that was closed during confirmation Reported on 2.3.5-p1 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

4 participants