This post assumes the reader is familiar with Magento 2 modules and how they work. If not, it is highly recommended to read the documentation first. All files mentioned below must be placed inside a module.
In order to add a custom layout handle to category page, a (basic) Magento 2 module with these additional files and their content is needed:
events.xml file to “subscribe” to the event and say which observer should be fired ↵
2. An observer that adds a new layout handle to the page ↵
3. A layout file that adds needed changes to the page ↵
One of the things that Magento first version lacked was an ability to clean up module data from the database upon its removal. This is a common situation when you uninstall an extension but all the related data remains in the database. You can only get rid of it manually. It is inconvenient especially if the module has created a bunch of new tables, custom attributes, system configurations etc. In this case, an automatic removal tool of such data would be very useful.
In Magento 2 there is a great feature, which allows to create an uninstall script for your module. Let’s find out how it works.
Magento 2 Command-line interface (CLI) tools differ from those in Magento 1. In Magento 1 you could simply add a script to the “shell” directory, include abtract.php, and extend from it. Magento 2 is a bit more complicated. This post will show you how to create a simple CLI script in Magento 2.
It has never been easier to create a development environment. No meter what operation system you use with Docker you can build the exact configuration you need. In this post we will provide steps for creating a sample Magento development environment configured in a single docker-compose.yml file.
Creating a custom theme in Magento 2 involves a process of registering your theme. In this post we will describe how to do it. All the awesome theme customizations are up to you.
Every unit test ninja faces troubles whenever he wants to test some real class functionality. Have you ever invoked toHtml() method of some block or beforeLoad() method of any collection? If you want to do it, you will need to mock a lot of classes that depend on other classes and so on. You would need to mock all of them, which would take a lot of time and effort. In a long run, you may blow up deadlines and it would really suck. Yes, you can try to change your testing strategy to avoid invoking such methods. But what if you still need to test them? I’m going to show you how I handled this problem.
We’ve already described the handy CLI tool for Magento 1 developers called n98-magerun and the ability to speed up the development process using it – in the article. And now we would like to talk about new n98-magerun2 for Magento 2 provided by netz98. It worth mentioning that its previous version was very popular among Magento developers and we think that n98-magerun2 should be another very useful command line interface tool for new Magento version.
So, let’s install n98-magerun2 and try how it works.
Most of Magento developers face with the problem of the same operations repetition for many times – that takes some time and slows down the development process. So, it’s a wise idea to simplify and speed up some operations during the work, isn’t it? Fortunately, we have a great CLI tool and it makes Magento developers life easier. It is n98-magerun provided by netz98.
In the part 2 we have described the powerfulness of terminal multiplexers and reviewed one of the most popular terminal utilities – Tmux. Such kind of multiplexers might greatly boost your performance in handling different CLI operations. Let’s go forward and imagine the trivial situation, when you have created your own handy CLI environment with many terminal windows in one tab or so. You have everything under your hand but sooner or later you have to reboot your computer because of a new system update or installing some applications that require the system restart. In this case, your terminal multiplexer process will be shut down and you will lose all your settings. Fortunately, there are few lovely utilities that help save all your windows/tabs configurations and allow to recreate the entire tabs with windows.
In the previous article we wrote about few improvements that you can implement for your Command Line Interface (CLI). But “Perfection knows no limits” and in this article we would like to dig deeper and describe few additional solutions that will make your CLI more powerful in your hands.
Many developers/system administrators sooner or later face with the situation when one terminal window or even few terminal tabs is not the most convenient solution. You want to have everything close at hand: to see all terminal windows at the same time. Sure, you can tile all terminal windows or improvise in some other way but for making the things easier let’s give a shot for a terminal multiplexer.