Magento 2: ERR_TOO_MANY_REDIRECTS After Importing Database

Problem: Getting 302 redirects (ERR_TOO_MANY_REDIRECTS error) after I imported the server’s database into the local Magento setup. I am getting the redirect error on both backend and frontend. Investigation: I checked for the values for the web/ page in core_config_data table. MariaDB [magento]> SELECT * FROM core_config_data WHERE path LIKE "web/%"; +———–+———+———-+———————————————+——————————+———————+ | config_id | … Read more

Magento2: Programmatically Create Custom Layout XML

This article shows how you can create a custom layout XML handle programmatically in your custom module in Magento 2. I will be using event observer for this. app/code/Company/Module/etc/frontend/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="layout_load_before"> <observer name="mycompany_custom_layout" instance="Company\Module\Model\Observer\CustomLayout" /> </event> </config> app/code/Company/Module/Observer/CustomLayout.php Here, I am checking if a customer is logged in or not … Read more

Magento: Programmatically Remove Layout Block

This article shows how you can remove layout blocks through the PHP Program instead of working in the layout.xml file in Magento 2. I will be using event observer. app/code/Company/Module/etc/frontend/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="layout_generate_blocks_after"> <observer name="remove_block" instance="Company\Module\Model\Observer\RemoveBlock" /> </event> </config> app/code/Company/Module/Observer/RemoveBlock.php Here, I am checking if a customer is logged in or … Read more

Magento 2: Images of old image gallery not showing in new media gallery

The new/enhanced media gallery was announced with the release of Adobe Commerce and Magento Open Source 2.4. Enable New Media Gallery STORES > Settings > Configuration > ADVANCED > System > Media Gallery Set Enable Old Media Gallery = No This will then enable the new media gallery. Access New Media gallery CONTENT > Media … Read more

Magento 2: Recent Order not showing in Sales Order Grid

You place an order from frontend and expect it to be displayed in the Sales -> Orders grid in the Magento backend. But, you don’t see your recent order in the sales order grid. Cause This is because Magento uses Scheduled Grid Updates. The order related grids (order, invoice, shipment, credit memo) are updated via … Read more

Magento 2: Admin ERR_TOO_MANY_REDIRECTS

This article provides a solution to the redirect loop error while logging in to the Magento admin panel. Did set up an existing Magento shop. Went to the Magento admin login page Entered admin username and password Got the ERR_TOO_MANY_REDIRECTS error The website has a redirect loop ERR_TOO_MANY_REDIRECTS Cause The problem is with the Cookie … Read more