There were a lot of rumors and talks about Magento 2 recently. It’s known that Magento 2 is not just a simple upgrade of Magento 1 we used to; it’s a separate system with many new features and different logic behind it.
Thus extensions that are built for Magento 1 cannot be simply upgraded to match new Magento 2 frames; they should also be built from the scratch. Here is a guide for you that will help you understand the logic of Magento 2 extensions as well as build your own module sample with the help of Magento 2 module creator.
The module prototype you’ll build is based on the company and module name. The above mentioned script creates PHP files and XML configuration for the module, so you don’t need to waste time on creating all these yourself.
Module components overview
- Cron Model implements different cron options;
- Items Model helps to create, edit, delete , module items;
- Block and Controller Adminhtml/Items display the elements of the Item collection in the admin panel.
Setup instructions
1. Type the name of your company, extension as well as your contact email in the form.
2. Press “Generate” button.
3. Wait for the module package to be generated and sent to your email.
Installing the module instructions
1. You should unpack the extension ZIP you’ve received.
2. Use FTP/SFTP/SSH client to connect to your site source. Upload the files and folders from the extension package to the corresponding root folder of your Magento site.
Note: You should use the “Merge” upload mode, this means that you don’t need to replace the whole folders, just merge them instead. It is recommended to use Transmit for MacOS.
3. Then you should connect to your Magento directory with SSH.
4. The next step is to run these commands:
php bin/magento module:enable Amasty_Modulename
user@55m:/var/www/store$ php/magento module:enable Amasty_Promo
php bin/magento setup:upgrade
user@55m:/var/www/store$ php bin/magento setup:upgrade
5. Flush Magento cache, for this you should go to System – Cache Management.
6. The extension is installed.
Summing Up
You can get the Magento 2 Module creator at Amasty website. It’s completely free. If you want to contribute to the project, you can find the script at GitHub.