To remove product attribute programatically, create InstallData.php and and define the method intsall() as follows
File : app/code/PHPCodez/First/Setup/InstallData.php Continue reading Magento 2 Remove Product Attribute Programmatically
To remove product attribute programatically, create InstallData.php and and define the method intsall() as follows
File : app/code/PHPCodez/First/Setup/InstallData.php Continue reading Magento 2 Remove Product Attribute Programmatically
To add product attribute programatically, create InstallData.php and and define the method intsall() as follows
File : app/code/PHPCodez/First/Setup/InstallData.php Continue reading Magento 2 Add Product Attribute Programmatically
To add customer attribute programatically, create InstallData.php and and define the method install() as follows
File : app/code/PHPCodez/First/Setup/InstallData.php Continue reading Magento 2 Add Customer Attribute Programmatically
Follow the below steps to create new command line in to Console CLI in Magento 2.
Define command in di.xml
In di.xml file, you can use a type with name Magento\Framework\Console\CommandList to define the command option. Continue reading Add New Command Magento 2
We can rewrite controller with the help of router. Magento provides the attribute before/after to config the module sort order which define what module controller will be find first.
For example, if we want to rewrite the controller customer/account/login, we will define more route in the route.xml like this: Continue reading Magento 2 Routing Rewrite Controller
The Route will define name for a module which we can use in the url to find the module and execute the controller action.
In Magento 2, the request url will be http://phpcodez.com/index.php/front_name/controller/action Continue reading Magento 2 Routing
As you have heard, Magento 2 is using the events driven architecture which will help too much to extend the Magento functionality. We can understand this event as a kind of flag that rises when a specific situation happens. .
Dispatch event
In Magento 2 Events List, we can use the class Magento\Framework\Event\Manager to dispatch event. For example, we create a controller action in PHPCodez_First to show the word “Hello World” on the screen: Continue reading Magento 2 Events
Magento 2 provide us the uninstall module feature which will remove all of the table, data like it hadn’t installed yet.
File: app/code/PHPCodez/First/Setup/Uninstall.php Continue reading Uninstall Setup Script Magento 2
Recurring script can be used to run some script that need to executed whenever we issue php bin/magento setup:upgrade irrespective of version change.
The recurring script will be run after the module setup script every time the command line
php bin/magento setup:upgrade
This script will be defined same as InstallSchema class but difference in name of the class. The example for this class you can see in vendor/magento/module-indexer/Setup/Recurring.php
The UpgradeData will be run during module upgrade and its used to alter the table structure.
The module upgrade script will run when you run the following command line Continue reading UpgradeData Magento 2