The Magento Module

module-structureMagento is a shopping cart application written in PHP with an MVC style architecture. Model-View-Controller applications aim to separate the representation of information contained in the database from the presentation of that information to the user. This architecture pattern leads to increased reuse of code within an application, simplification of design, and ease in maintenance (separation of concerns). The model contains business rules, application data, logic, and functions. The view generates the display of the application data to the user. The controller passes information between the view and the model. Each model in the application separates an area of functionality from others.

To extend the functionality in your Magento, you can create custom modules to do nearly anything you desire. Your custom changes should *never* be placed in the core code so you don’t lose them when you upgrade. Magento contains 3 code pools (groups of modules): core, community, and local. Your modules should be placed in community (if developing for use on multiple magento instances) or local (if developing for your single magento installation).

Namespace refers to a folder used to group similar modules together. What you place in your custom module can override what is in the core or can extend the core with altogether new functionality.

module-structureA module can consist of the following components:

  • Block – contains the layout information
  • Models – implement business logic
  • Resource Models – provide an access layer to data for the extension
  • Controllers – contain methods called actions which process web server requests that correspond to the module
  • Configuration – module-specific XML config files which tell Magento how this module interacts with it
  • Helpers – auxillary classes that implement commonly used business logic – forms, validators, formatters, formatters, etc
  • Schema SQL Scripts – the SQL scripts that implement schema changes for the module
  • Data SQL scripts – scripts which manipulate the data for the SQL schema of the module. NOTE: difference between Enterprise and Community Editions.

Leave a Reply

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