An overview Of Opencart Development – Lecture 1


Opencart allows you to extend its functionality in multiple ways.

  1. Module
  2. Extensions
  3. Events

Modules

Modules are basically independent chunks of code that can be set on any layout on the front end. For example slideshow can be called a module, so slideshow will have a setting panel in the admin side and it will also be assigned to any page on the frontend.

Every frontend page has four sections where a module can appear number.

  1. Top: Below Header.
  2. Bottom: Above Footer.
  3. Left: Left SideBar
  4. Right : Right Sidebar

So if slideshow is is set to the top it will appear below the header on the page and if its assigned to the bottom it will appear above footer on the page for the left and right the content will take 75% of the page and 25% will be given to the left panel and if both left and right have some models assigned the content will take 50% and 25% and 25% will be given to the left and right .

So modules are actually independent of the Framework in the sense that if they are disabled they won’t be consuming any resource and the code will not run.

Extensions

Extensions basically allows the Framework functionality to be altered enhanced or add with the already built functionality.

So the code base of the Framework will be changed. Extension code will basically run with the Framework code and will be dependent on the Framework .

A question arises that if extensions are changing the  framework, they might cause a damage or they will be changing the original code forever.

Answer is , extensions will change the Framework code but the files that are original will not be replaced install Opencart all hours to do such changes with the help of a virtual code system called OCMOD.

What is OCMod?

Ocmod is an xml-based application that allows you to alter the original files Court court code but it creates a virtual copy of original file and run that virtual file instead of original.

Sofa that will be running with the virtual files if any extension is installed based on AC mode and symbol

So Where Does The Extension Requirement Comes?

Extensions are required in some cases where the modules do not do the required work for example we need to add some Javascript code or any meta tags in header or footer that is required by our module.

Or we may want to alter the code in original files to get our required functionality.

Events

Events are like wordpress filters you can use events to run your own code after some default function is executed so you may like to do some extra work after product is saved event can help in such conditions.

A use case of event can be sending an email when products price is changed.

Events  events are not much popular in community but they surely have some of the benefits and some use cases in which these are helpful.

Further Reading About

Events: https://www.opencart.com/blog?page=10&blog_id=174

Ocmod: https://github.com/opencart/opencart/wiki/Modification-System