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.
In the previous post we have described how to add a new widget in Magento 2. As it was mentioned, each widget field has its own input type. The input type allows determining what graphical interface component will be used to represent this field. Magento 2 has a set of simple input types out of the box such as input field, dropdown etc. Also, it has more complex components: products chooser, rules conditions component, CMS block chooser and others. But in some cases you need to add your own input type, for example if you want to allow choosing an image from media gallery in your widget configuration. In this post we review how to add an image chooser/uploader to your widget.
Magento 2 has a handy toolkit for static content management on the site that is called Content Management System (CMS). The toolkit consists of three main parts: pages, blocks and widgets. Pages allow us to manage content of an entire page. Blocks provide an ability to edit content of separate page elements. The main difference between blocks and widgets: if you need to change block parameters, you usually have to do it programmatically. Widgets are similar to static blocks, they allow to insert various content into static pages or static blocks. As a rule, widgets have configurable parameters that can be set up when adding it via admin panel.
During our work with Magento security patch SUPEE-7405 and its patch-fixes (version 1.1) we’ve noticed an error which is logged as an exception and it can be even a source of security exploit if exception.log file is world readable. In this article we describe this bug and fixes for it.
To begin with, we should create a folder with an extension for making a simple Hello World module with the custom route for Magento 2. As you may also know, in Magento 2 – there are no code pools like in Magento 1.x.
Ability to create pages with custom content is a great feature provided by Magento. You can easily create a new page for your store and add text, html, images, different widgets there. But sometimes people want to have something non-trivial on their pages. Usually it means that you need to operate some knowledge before you’ll get an appropriate result. In this article we would like to suggest you a simple solution on how to place a products list, prefiltered by some specific attribute, on your CMS page. The example below describes how to create a simple extension for this purpose.
We continue to share our experience with Magento developers by publishing the next set of Best Practices in Magento coding. If you missed our previous article, here it is.
All of Magento’s built-in backend modules share the same route, which is set during the installation process and defaults to ‘admin’. Here we will show you how to allow custom built modules to use the same route, so that you have consistent url routes in the back-end.