Magento 2: How to Change Category Attribute Value Programmatically

Introduction Imagine we are working on the client’s project. It serves on staging and production servers, of course. But we are working locally. And we need to change a category attribute value. It’s easy! Just navigate to the admin panel and select the necessary value. But this is a bad practice. Because now we should remember about this attribute and after ticket will be deployed to staging we should change attribute value here also....

May 13, 2023 · 2 min

Magento 2: How to Show All Layout Xml for Certain Page

Introduction Imagine you should fix something in Magento 2 on the product listing page, for example. You added an data (like new block with arguments, for example) to the catalog_category_view.xml layout but your changes doesn’t respond on front-end. Solution To check if your data exists in the catalog_category_view.xml layout you should print all layout on the product listing page. Navigate to the following class and method: \Magento\Framework\View\Layout\Builder::generateLayoutXml After this line $this->layout->generateXml(); add the following...

April 30, 2023 · 1 min