With the official End of life for Magento 1 coming in November 2018 – it is time to start using Magento 2 in order to transition our sites on to the platform well before we have to.
I have said it before and I will continue to say it – there seem to be very few articles about any given task in Magento. There are a couple but you generally have to read all of them and then trial and error to get even the simplest things to work… which is frustrating and makes you wonder whether the authors have tested their code or perhaps that something fundamental has since been changed in Magento and the articles have just not been updated to reflect that.
I have just spent 2 hours attempting to simply install a very basic custom module as the first step of replicating a series of import scripts from M1 to M2.
All this code has been tested at the time of writing and worked with Magento 2.2
Step 1 – Creating your Folders
If this is a fresh Magento 2 install you may well not have a code directory within /app/. If you don’t then simply create it.
a) Create the following folders
The Blackrhino folder is the module’s namespace, and Import is the module’s name. I will not claim that all the following files are required to get the module to import but it will certainly work with them (I know this because I have actually tested the code).
b) Now that we have a module folder, we need to create a module.xml file in the app/code/BlackRhino/Import/etc folder with the following code:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Blackrhino_Import" setup_version="1.0.0" />
c) To register the module, create a registration.php file in the app/code/Blackrhino/Import folder with the following code:
more to follow….