Create your first module in Magento 2

New to Magento 2?

Here’s the guide on “How to create your very first module in Magento 2?

Folder structure of our basic module.

Add code inside app/code/{{Vendor Name}}/{{Module Name}}

For example,


To get a list of modules pre-installed after installing Magento 2, run following command in terminal

php bin/magento module:status

To get the module listed, create following two files

  •  registration.php
  • module.xml

1. Create Registration

First, register the module by adding registration.php file here


Add following code in registration.php

 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.


2. Create Module xml

Add file module.xml here


Add following code to module.xml

<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Itdeation_HelloWorld" setup_version="0.0.1"> 

Now run following command again

php bin/magento module:status

Our module is now listed under disabled modules.

Run following command to enable it

php bin/magento module:enable Itdeation_HelloWorld

And then upgrade the module by running following command

php bin/magento setup:upgrade

3. Create a Router

Module is now enabled, let’s print “Hello World” on front-end.

Define a router to hit a custom url.

Create routes.xml here


Add following code in routes.xml

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="helloworld" frontName="helloworld">
            <module name="Itdeation_HelloWorld" />

Here we’re defining our router id as “standard” and route with an id “helloworld”.

The frontName attribute is going to be the first part of our URL.

In Magento 2 URL’s are formed as:


So in our example, the URL will look like this:


4. Create a Controller

Let’s create Index.php here,


Add below code in Index.php


namespace Itdeation\HelloWorld\Controller\Index;

use Magento\Framework\App\Action\Context;

class Index extends \Magento\Framework\App\Action\Action
    protected $_resultPageFactory;

    public function __construct(Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory)
        $this->_resultPageFactory  =$resultPageFactory;

    public function execute()
        $resultPage = $this->_resultPageFactory->create();
        return $resultPage;

5. Create a Block

Create a block that will return “Hello World” string to be rendered on screen.

Create a HelloWorld.php file here


Add following code to HelloWorld.php

namespace Itdeation\HelloWorld\Block;

class HelloWorld extends \Magento\Framework\View\Element\Template
    public function getHelloWorldString()
        return 'Hello World';

Create a phtml file to call the above block and get the Hello World string.

6. Create phtml file

Create view.phtml here


Add following code to view.phtml

<?php echo $block->getHelloWorldString(); ?>

7. Create a layout

Create a layout file to tell magento which controller to use and which view and block files to use on hitting url.

Create layout file helloworld_index_index.xml here


Add below code in helloworld_index_index.xml

<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd" layout="1column">
        <referenceContainer name="content">
            <block class="Itdeation\HelloWorld\Block\HelloWorld" name="helloworld" template="view.phtml" />

Clean the cache by running below command in terminal

php bin/magento cache:flush

Hit the following url in browser


Here’s the output on frontend.

Signs thats says your business needs an ERP

Great leaders inspire actions and they always starts with a question WHY? So let’s start – Why do I need ERP for my business?

Your projections are purely based on assumptions than figures derived with analytical perspective. It takes longer and longer to reconcile your finance at the end of month. Struggling to keep up with surge in order volumes resulting into customer dissatisfaction. You have no idea about stock lying in your warehouses.

If this sounds similar to your problem statement—then its time to consider an ERP system. Read on to discover about few of the signs indicating your business needs an ERP.

# 1 – Multiple applications to handle various processes

Some firms believe that their operation is simple enough that they can control it with a few spreadsheets/applications. Just think about how information at your company is being recorded, tracked and processed. Does your staff uses one system for accounting, another to enter customer orders and warehouse uses a completely different solution to track shipping and receiving? Reconciliation of data from isolated department resembles to the picture? Do you have front-end and back-end systems running separately?

Such situations leads to inaccurate data from sales, due to which inventory management may suffer, while not having the latest information from accounting can trigger a ripple effect on everything from marketing budgets to payroll.

ERP software integrates these systems so that every business function is connected to single database giving accurate and real-time data. Which helps staff make better decisions more quickly and frees up their time to work on more high-value exercises like helping the business grow even faster.

# 2 – Don’t have data at your fingertips

What if you are asked about your average sales margin or any metrics like orders per day or sales to date for that matter? Companies having isolated systems or working on spreadsheets need to constantly reconcile data manually, and that could be a long wait!

However Odoo ERP solution can give a holistic view of your business operations at any point of time, while your employees can get the information they need to do their jobs more effectively. ERP systems calculate and collect costs so you always have an accurate picture of your product cost and margins. Another example is- sales person should be able to drill down into customer’s full transaction history and more proactively improve renewal rates. Also 

#3: Finance reconciliation is herculean task

One of the noticeable signs that your company needs ERP software will come from your accounting department. If your staff depends on paper-based invoices and sales orders—and spend hours every week manually entering them into different accounting and sales systems—you need to evaluate how much time can be saved on such tasks using ERP software which can handle in an instant.

Same is case for financial reporting—if it eats away most of the productive time to consolidate or reconcile financial information across systems and through countless spreadsheets, an ERP solution can make a significant impact. With all financials in a single database, accounting employees won’t have to spend hours cross-posting information, rekeying numbers, or reconciling data manually.

Implementing ERP like Odoo automatically process transactions and generate audit trails and financial reports that can simplify period-end closings. System can flag anomalies so you can investigate quickly, and system also simplifies repetitive journal entries and other activities that make closing a time consuming task. All this will help your staff to work with more productivity, freeing them to deliver critical reports without delays and frustration and on top of that you know the health of your business sooner.

#4: Declining sales due to customer dissatisfaction

Inventory management often becomes a challenge as companies grows. When sales, customer & stock data are maintained in isolation, ensuring right amount of products at right location/warehouse at the right time becomes chaotic for the business operations. Such problems can result into outage of popular product until the next shipment arrives. Meanwhile, if a customer calls to inquire about an order and employees can’t track it to see if it’s been shipped—or if it’s even in stock—your company will start to develop a poor reputation for reliability and service.

With an ERP system, on the other hand, employees in every department will have access to the same and realtime information. Customers like accurate delivery dates, and ERP can help you provide them with improved inventory and shop floor visibility. Not only that Odoo/Openerp have got the solid re-ordering feature which can be configured by the authorised person to keep optimum stock to satisfy the customer need.

#5: Leads not turning into opportunities

You may fail in turning leads to an opportunity when they are kept on hold for longer time while your company employee is fetching data from different department.

Odoo/OpenERP CRM can directly create leads for relevant incoming mails and give you best view in scheduler to ensure that your schedules focus on priorities, leading to shorter lead times. Company’s representatives would be able to resolve customer queries regarding order, shipping, payment, service etc., without wasting time in checking with different departments. 

#6: Company’s IT is getting complicated and expensive

Using multiple systems across your business makes IT management a nightmare because customizing numerous systems, integrating them and maintaining them with patches and upgrades can be complex, costly and hampers critical time and resources. In fact such ad-hoc upgrades can undo the changes implemented by your company’s IT staff.

Instead of working in isolation and making it more complex, Enterprise Resource Planning software implementation can make your company nimble to respond to growing business needs.

And to overcome ITdeation Technologies can be your technology partner who can help you in implementing ERP – Odoo/OpenERP to make your business function in more easier & efficient way than ever.

To know more about ITdeation Technologies services on Odoo/OpenERP, please visit – ITdeation – Odoo Services