How to Create Simple Custom Module in Magento 2 ?

How to Create Simple Custom Module in Magento 2 ?

Blog
Module in Magento 2 Modules and themes are the units of customization in Magento. Themes strongly influence user experience and storefront appearance, while Modules provide business features, with supporting logic. Basically, a module is a logical group – that is, a directory containing blocks, controllers, helpers and models that are related to a specific business feature. Or simply we can say, we use a module to implement a new functionality. Simple Helloworld Module In Magento 2, modules will be in app/code directory of our Magento installation, with this format: app/code/Vendorname/Modulename. Now let us follow these steps to create a simple module which works on Magento 2 that displays text 'Hello World'. Step 1: Create a folder for Hello World module Step 2: Create etc/module.xml file Step 3: Create registration.php file…
Read More
How to Get Product Collection in Magento 2?

How to Get Product Collection in Magento 2?

Blog, Uncategorized
Blog Overview In the previous blog, we learnt how to get customer collection in Magento 2. In this blog, we shall see how to get product collection in Magento 2. Step 1 : Create the 2 mandatory files: Refer this blog and create module.xml file inside etc folder and registration.php file inside Code5fixer/ProductCollection folder. Here, ProductCollection is the name of the module folder. app/code/Code5fixer/ProductCollection/etc/module.xmlapp/code/Code5fixer/ProductCollection/registration.php Step 2 : Create a Controller file: As a next step, we shall create a page using controller, in which we are going to display product collection in the frontend. To do so, create a folder inside CustomerCollection folder and name it as Controller. Inside Controller folder, create a folder and name it as Product and inside Customer folder, create a php file and name it…
Read More
How to Create Custom Shipping Method in Magento 2?

How to Create Custom Shipping Method in Magento 2?

Blog
Blog Overview Shipping is indeed one of the most significant aspects of e-commerce. Shipping in eCommerce refers to all the services that are required to transport the products purchased online from a retailer to a customer's delivery destination. Here are the steps to create a custom shipping method. Step 1 : Create the 2 mandatory files: Refer this blog and create module.xml file inside etc folder and registration.php file inside Code5fixer/Simpleshipping folder. Here, Simpleshipping is the name of the module folder. app/code/Code5fixer/Simpleshipping/etc/module.xmlapp/code/Code5fixer/Simpleshipping/registration.php Step 2 : Add the module configuration : To add a module configuration, we have to create system.xml file. Therefore, create a folder inside etc folder and name it as adminhtml. Inside this adminhtml folder, create an xml file and name it as system.xml The contents of Index.php…
Read More
Useful Commands List In Magento 2

Useful Commands List In Magento 2

Blog
Setup Upgrade Command Line Run the Setup Upgrade Command to upgrade your store when install / update an extension. php bin/magento setup:upgrade When to execute this command, When you made changes in the Setup script(InstallData, InstallSchema, UpgradeData, UpgradeScheme) When you install a new module At the time of the first Magento installation. When you change setup_version in module.xml After upgrading Magento version. Compilation Command using Command Line Run the Compile Command to generate the process. php bin/magento setup:di:compile When to execute this command, If you made changes like add new dependency in __construct(), changes in di.xml, Add new controller… If you are in developer mode you can simply delete changed files from var/generation folder for Magento 2.2.x version and /generated folder for Magento 2.3.x Static Content Deploy Command using Command…
Read More