Last week I noticed my items pages started showing strange. In doing some digging I notice that the page has this body class- page-layout-2columns-left My item page is only one column. I went and looked at my catalog_product_view.xml page and I can see page layout 1column at the top.
I didn't change any code last week so I thought it might be a configuration issue. If the catalog_product_view.xml page shows the correct number of columns what else can I do?
Hello @TylerWolf,
Please check any product in admin. In admin section Go to Catalog-> Product ->Edit any Product(by clicking edit) -> Design -> Layout
Please check this config setting. If this is set as no layout updates, set them to 1 Column and then save. Flush magento cache and reindex the data.
I hope this will help help. If still you face same issue, please let me know.
If this helps you, please accept it as solution and give kudos.
Regards.
Hello @TylerWolf ,
Please check your custom theme or custom module. May be there in catalog_product_view.xml the "layout" attribute of page is given as 2columns-left.
If you want to bulk update the layout for all products the create a file in magento root directory as update_product.php with:
<?php use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $state = $obj->get('Magento\Framework\App\State'); $state->setAreaCode('frontend'); try { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection'); $collection = $productCollection->addAttributeToSelect('*') ->load(); $idArray = []; foreach ($collection as $product){ $idArray[] =$product->getId(); } $value = "1column"; $productActionObject = $objectManager->create('Magento\Catalog\Model\Product\Action'); $productActionObject->updateAttributes($idArray, array('page_layout' => $value), 0); } catch(\Exception $e) { echo $e->getMessage(); exit; }
And execute this file(or just hit the url in server as YOUR_MAGENTO_BASEURL/update_product.php I hope this will help you.
If this helps you please accept it as solution and give kudos.
Regards.
I think that might solve the issue, but not permanently. When I switch theme to Luma there isn't a problem. It seems to be in my theme, but this issue didn't exist in 2.3.1 only 2.3.2.
Hello @TylerWolf
Please check your theme's Magento_Catalog/layout/catalog_product_view.xml. May be there the "layout" attribute of page is given as 2columns-left.
If it helps you please accept it as solution and give kudos.
Regards.
I ended up getting a response from Magento support that solved this issue for anyone else that comes across this-
I checked this issue, this happens when the page builder module is available
1) The plugin mention below checks whether the page layout is "category-full-width", if TRUE, it set the body class to "page-layout-2columns-left"
vendor/magento/module-page-builder/Plugin/Result/Page.php::beforeRenderResult
2) The reason why the products having the "category-full-width" page layout is due to this setting in category, see the screenshot attached here.
Admin -> Catalog -> Category -> Select "product" category -> Go to "Design Tab"
3) Since "Apply design to products" setting is enabled, the layout design setting of the category get applied to products the when a product is browsed from that category
Hope this make sense, if you do not wish to inherit the category layout setting to products, then disabling the "Apply design to products" would solve the issue.