I am going to explain here a way to add a breadcrumb in the default Magento Contact Us Page as an example 1) Create a layout file I have a theme module Decryptweb_Project, so creating a layout file inside it app/design/frontend/Decryptweb/Project/Magento_Contact/layout/contact_index_index.xml 2) Reference the existing breadcrumbs block
Category: XML
View all posts filed under XML
Hide admin login in Magento 2
If you are using a SSO to login into Magento admin, you may need to hide the default Admin login functionality. I am mentioning here an important code snippet to hide the admin login form. 1) Create an admin layout For example, I have a module DecryptWeb_Admin, I am going to create a layout file […]
Custom CLI commands Magento 2
Magento 2 enables your component to add commands to the default CLI Magento has one command-line interface that performs both installation and configuration tasks: /bin/magento. I am explaining here a way to add custom commands for your module. 1) Create a Command class, I have created a custom class at app/code/DW/Interface/Console/OrderCron.php. 2) Declare your Command […]
Custom Log File in Magento 2
Magento provides multiple types of logs by default (info, notice, warning, critical etc) Recently I had to use custom log files for a custom module that I implemented. I will try to explain here the multiple approaches to do that, a) Set a custom file in your module’s di.xml file In the di.xml file of […]
Reading XML
I am listing here method for reading XML file or XML string with the help of PHP. The output on executing above code will be: I am listing here another example: The output on executing above code will be: For further reference click here
Generate XML
XML files are used for various functionalities. We can develop XML files by using PHP. If you have to develop very small project, you can use XML files for saving data instead of MySQL or any other databse with PHP, which will be easy for maintaining and response time will be reduced. I am listing […]