Skip to content

Module developer's tutorial

beatnbite edited this page Jun 3, 2011 · 29 revisions

Module Developer's Tutorial

Introduction

LiteCommerce is an e-commerce solution written in object PHP 5.3 and having a modular architecture. In order to keep future updates and upgrades easy and simple, all changes to e-commerce websites built with LiteCommerce should be made as modules. Neither functions, nor design should ever be modified with direct hacks to the files of LiteCommerce or its modules. Even a bug-fixing patch should be distributed as a module until the bug is fixed in a newer LiteCommerce version.

A LiteCommerce module is a collection of files that includes:

  • PHP scripts, extending or replacing the default functionality of LiteCommerce.
  • Template files, extending or replacing the default look of the pages and blocks generated by LiteCommerce.
  • Resource files (images, styles, and so on) used by the above two groups.
  • YAML files with the data that is to be imported into the LiteCommerce database when the module is enabled.

Depending on the purpose of a certain module, it may miss some of the listed components: thus, a theme module is likely to miss scripts and data files, and a language module may include a single YAML file with the translation strings.

Modules are distributed in the form of a single package that includes all the module files. There are three ways to install a module in LiteCommerce:

  1. Unpack the module package manually and then copy the module files to the server. This is the most difficult (and least recommended) way, because here user must know which directories different groups of files are to be copied to.
  2. Upload the module package in the LiteCommerce back-end. It will be unpacked and copied to the appropriate directories automatically.
  3. We list popular modules in our Module Marketplace directory. LiteCommerce users can buy, install and update modules listed there directly from their LiteCommerce back-end. This is the easiest (and most recommended) way of installing LiteCommerce modules. You can submit your module to us for a review to be added to the Module Marketplace.

When a module is installed, it is listed in the LiteCommerce back-end and can be enabled by user. Until the module is enabled, it doesn’t affect LiteCommerce functionality, design or database. If user disables a module, all of its classes, templates and database data become hidden from LiteCommerce.

Table of contents

  1. Perparing for work
    • Installing LiteCommerce
    • Locating LiteCommerce files
    • Configuring developer-specific settings
  2. Creating module
    • Choosing module name
    • Module structure
    • Add odule descriptor class (Main.php script)
    • Enabling module in LiteCommerce
    • Creating module package
    • Coding standards
    • Submitting module to the Module Marketplace directory
  3. Customizing LiteCommerce appearance
  4. Extending the LiteCommerce functionality
  5. Working with models
    • Creating a model
    • Improting model data on module installation
  6. Multilingual support
    • Overview
    • Multilingual messages
    • Multilingual model fields
Clone this wiki locally