magento2-page-builder icon indicating copy to clipboard operation
magento2-page-builder copied to clipboard

Layout shouldn't be set in a `page_layout` xml file.

Open jasperzeinstra opened this issue 4 years ago • 5 comments

Preconditions (*)

  1. Magento Page Builder version >= 1.3.0

Steps to reproduce (*)

  1. Create a Magento_Catalog/layout/catalaog_category_view.xml in your theme.
  2. Set the attribute layout of the xml-node page to 1column

Expected result (*)

  1. Category page has layout one column

Actual result (*)

  1. Category page has layout two columns left

This issue is caused by the file view/frontend/page_layout/catalog_category_view.xml. A page_layout file should never set a layout becasue they are the last loaded layout xml files. This bug overwrites the value for layout set in the theme.

This is the patch that resolves the issue. I don't have a paid GitHub account, so can't create a PR.

===================================================================
--- a/view/frontend/page_layout/catalog_category_view.xml	(date 1592218590076)
+++ b/view/frontend/page_layout/catalog_category_view.xml	(date 1592218590076)
@@ -5,7 +5,7 @@
  * See COPYING.txt for license details.
  */
 -->
-<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
+<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
         <referenceContainer name="category.view.container">
             <referenceBlock name="category.description" template="Magento_PageBuilder::catalog/category/view/description.phtml"/>

jasperzeinstra avatar Jun 15 '20 11:06 jasperzeinstra

Hi @jasperzeinstra. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

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


m2-assistant[bot] avatar Jun 15 '20 11:06 m2-assistant[bot]

For what it's worth, layout="2columns-left" is applied to other instances of catalog_category_view.xml, too (see attached).

Screenshot 2020-08-11 at 11 17 05

bluemwhitew avatar Aug 11 '20 10:08 bluemwhitew

Very strange, after an update from magento 2.4.2-p1 to 2.4.3 suddenly this exact issue surfaced. Now im not able to change the layout on the category page anymore from the theme. When removing the layout attribute in /magento/vendor/magento/module-page-builder/view/frontend/page_layout/catalog_category_view.xml it works again.

marvinhinz avatar Sep 20 '21 16:09 marvinhinz

I think the issue is that catalog_category_view.xml is in the wrong folder.

Is there any specific reason it is in app/code/Magento/PageBuilder/view/frontend/page_layout ?

If not then it should be moved to app/code/Magento/PageBuilder/view/frontend/layout which fixes the current issue and makes sense given that app/code/Magento/PageBuilder/view/frontend/layouts.xml contains the 3 page layouts and no references to catalog_category_view

    <layout id="cms-full-width">
        <label translate="true">Page -- Full Width</label>
    </layout>
    <layout id="category-full-width">
        <label translate="true">Category -- Full Width</label>
    </layout>
    <layout id="product-full-width">
        <label translate="true">Product -- Full Width</label>
    </layout>

Looks like there is already a pull request #782 to fix this issue @unailopez16 what do you think about this propose solution?

Additionally testing this solution with luma on 2.4.3 seems to fix the issue.

SamuelColacchia avatar Sep 29 '21 01:09 SamuelColacchia

Hello @jasperzeinstra,

Thanks for the report and collaboration!

The mentioned issue is not reproducible for us. Please refer to the below comment for more details:

https://github.com/magento/magento2-page-builder/pull/782#issuecomment-1895371820

Let us know in case we have missed anything.

Thanks

engcom-Hotel avatar Jan 17 '24 09:01 engcom-Hotel