Posts

Rewrite an Existing Magento 2 Controller

This article will help you understand how to rewrite an existing Magento 2 controller.
Similar to how blocks, helpers and models are rewritten, we can create our own module and add a preference within in the module’s di.xml file.
This article will show an example of how to override the Magento\Cms\Controller\Index\Index controller class. For simplicity, ...

Rewrite an Existing Magento 2 Model

This article will help you understand how to rewrite an existing Magento 2 model. In earlier versions of Magento, you had to specify the rewrite within the module’s config.xml file. In Magento 2, this is done in the module’s di.xml file.
This article will show an example of how to override the Magento\Catalog\Model\Product class and ...

Rewrite an Existing Magento 2 Helper

This article will help you understand how to rewrite an existing Magento 2 helper. In earlier versions of Magento, you had to specify the rewrite within the module’s config.xml file. In Magento 2, this is done in the module’s di.xml file.
This article will show an example of how to override the Magento\Catalog\Helper\Data class and ...

Rewrite an Existing Magento 2 Block

This article will help you understand how to rewrite an existing Magento 2 block. In earlier versions of Magento, you had to specify the rewrite within the module’s config.xml configuration file.
In Magento 2, this is done in the module’s di.xml file.
The example below will demonstrate how add a preference in order to ...

Logging in Magento 2

Logging in Magento 2 has changed since the days of Magento 1.
In earlier versions of Magento, to log data to a file, you had to use the static log() or logException() method of the Mage.php class, which would either write data to the system.log, exception.log, or custom log files defined as an argument within ...

Adding a Customer Attribute in Magento

This article will how to go about adding a customer attribute in Magento.
Similar to the catalog_product entity, Magento uses the EAV model to store customer information. There are two entities involved here: the customer entity and the customer_address entity. These entity types can be found in the eav_entity_type in the database.
The two main ...

Adding a Category Attribute in Magento

Magento gives us the ability to add custom attributes into the database, as well as updating existing attributes. This article will demonstrate adding a category attribute in Magento.
For category attributes, there isn’t a nice interface within the admin area like there is for adding product attributes. Usually a developer will have to create a ...

Removing XML Blocks in Magento

This article will help you go about removing XML blocks in Magento.
Magento’s default theme comes with default layout blocks included such as a PayPal logo, a community poll and other unnecessary inclusions.

More than likely, you will want to remove these blocks when building your own custom theme.
There are two main ...

Adding an Input Filter to a ZF2 Form

If you followed the Form Creation in Zend Framework 2 article, you’ll want to know about adding an Input Filter to a ZF2 form.
One way to do this is to define your own input filter class.
This class will reside in the module’s Model/ directory and the input filter will be applied to the ...

Form Creation in Zend Framework 2

There are several different ways to go about Form Creation in Zend Framework 2. This article will focus on extending the Form class and using a form in the ZF2 Skeleton Application.
Assuming you have already created a basic module, you should be ready to start creating a form.
To start with, create a Form/ ...