Magento Extension Development – Beginner – Lesson 1

Grizzly Software & Technical Services
Sign up for tips, tricks, and the latest news in tech

Hello Folks,

This is the first lesson in a series on basic Magento extension development. You’ll learn how to build a simple extension as well as how Magento and Magento extensions work behind the scenes.

Before beginning this tutorial series, it’s expected that you already have some very basic Magento experience, a functional Magento site, and basic knowledge of FTP. If you don’t already have a basic familiarity with Magento, I suggest starting with the “Beginner” section here. It will cover Magento installation and a few basic functions.

Magento 2.0

 

I’ll start by listing the basic folder structure of a Magento store. This will be explained better later on.

app

-code

-local

-community

-core

-design

-frontend

-adminhtml

-install

-etc

-modules

skin

-adminhtml

-frontend

-install

– All the core modules of Magento will be listed under app/code/core section. Here you will find the code that provides Magento’s default functionality including things like Customer Registration, Wishlist, Product review, etc.

– Every module in Magento have an XML configuration file, this file basically tells Magento about its presence.

All the configuration files for each module would be defined under app/etc/modules section. These files are required in order to run any module in Magento.

– All the frontend or layout files in Magento are listed under app/design folder. Under this folder, you will find all the code involved in displaying the front end, or the customer facing side of the store.

– Now that we’re  done with basic folder overview, we’ll begin writing our first extension.

_____________________________________________________________________________

i) Package Name:- This would ideally be the name of the company or organization you are building the module for.

ii) Module Name :- Ideally you should provide a name which represents the functionality of your module.

iii) Codepool :- Magento has three code pools : i) Local ii) Community iii) Core

– These can be found in the app/code folder. Basically, CodePools divide the extensions according to the sections they represent. If you want to create your own custom module or extension for the project, then you should create it with app/code/local hierachy. If you are planning to upload your created extension to Magento community, then you should opt for app/code/community. All the core modules of Magento would be listed within app/code/core and you are always advised not to modify any of these files directly.

– Lets go ahead and create a small sample folder structure with the package name “Grizzly” and Module name “Basic” and see how it will look under a fresh Magento Setup.

app

-code

-local

-Grizzly

– Basic

-etc

-Controllers

-Block

-sql

-Helper

-Model

-community

-core

-design

-frontend

-adminhtml

-install

-etc

-modules

-Grizzly_Basic.xml

skin

-adminhtml

-frontend

-install

– So, this is how the folder structure will look. Under app/code/local , we have our package “Grizzly” and under that a module named “Basic”. All the modules would have different sections to

manage the process flow within the modules. Here we will create etc, Controllers, Block, Sql, Helper, and Model folders under our module. We will go on detail in the next tutorial on why and what these folders represent.

– Under app/etc/modules, we need to create the configuration file of our module. This file should be named according to your package and module in the format “Packagename_Modulename.xml”. As our package name is “Grizzly” and our module name is “Basic”, we would create a “Grizzly_Basic.xml” file under app/etc/modules directory.

– That’s it for this tutorial, in the next tutorial we will focus on how the folders under module directory works and how it communicates with the Magento System.

Leave a Reply

Your email address will not be published. Required fields are marked *