Modules

Fixing the ‘wysiwyg is not under storage root path’ error in Magento 2

If the media directory within your Magento 2 application is being used as a symlink, then there is a chance you may have encountered an issue with uploading media images in the admin. The error in question is as follows: /your/symlinked/mediadir/wysiwyg is not under storage root path. This post will describe steps to take in …

Add a Dynamic Route in the Magento 2 Admin

Many Magento 2 extensions, like blog modules, allow merchants to configure the URL of the page in the admin within the Stores -> Configuration area. Developers can add this functionality by adding a custom Magento 2 Router class allowing the merchant to add a dynamic route in the Magento 2 admin.
Below will describe the …

Add a Magento 2 Cron Job

The cron is an important feature of a Magento store on a production environments. Cron tasks that are scheduled at a set date and time are automatically executed, and in Magento this includes Google sitemap generation, newsletters, emails and more. To add a Magento 2 cron job, you must first add a custom module that …

Add Console Commands in Magento 2

Magento comes with a predefined list of Symfony based CLI commands that perform specific actions, such as deploying static content or clearing the cache. A developer has the ability to add console commands in Magento 2 by adding a module and configuring the command.
By adding the usual registration.php and etc/module.xml files within your module’s …

Uninstall Modules in Magento 2

To uninstall modules in Magento 2, you can either use a Composer command if the module has been installed via Composer, or remove the module manually if it was installed that way.
If you install a module via Composer, you can use Magento’s module:uninstall command which can be run from the root directory of …

Add a Magento 2 Service Contract

Magento modules use service contracts, which are a set of PHP interfaces including data interfaces, which preserve data integrity, and service interfaces, which hide business logic details from service requestors such as controllers, web services, and other modules. To add a Magento 2 service contract, first you must create and register a Magento module. This …

Add Private Content in Magento 2

Magento’s Page Cache module successfully caches page content and is now a part of the Community Edition releases. The cached content can be split into two parts: public content and private content.
Public content is stored within the cache location you specify for your Magento application, either in the file system, in the database, or …

Installing a Marketplace Module in Magento 2

Installing a Marketplace Module in Magento 2 is different to installing an extension in Magento 1. Magento uses a repository where Magento 2 and third party component Composer packages are stored. This repository name is repo.magento.com.
Generate your Access Keys
To provide secure authentication when downloading third party modules, Magento gives you the ability to …

Magento 2 Data Scripts

Magento 2 data scripts are responsible for adding data to the database. In terms of adding a module, the setup scripts will construct the table(s), and then the data scripts will import the data.
Magento 1 used this concept and added any data scripts to the ‘data’ directory in the module’s folder structure.
Within Magento …

Magento 2 Install Setup Scripts

Setup scripts are a key feature in the Magento application. They provide the ability for a developer to add, update or remove data from the database using PHP classes. This guide will focus on how to add Magento 2 install setup scripts.
Let’s add a new module to start with called ‘Siphor_Names’. Start with the …