Introduction
This chapter describes the process of creating a distributable addon (module) for X-Cart 5.
Choosing identifiers
Before you get started, you will need to choose two identifiers:
- developer ID
- module ID
Your developer ID will tell other programmers that the addon is written by you. It is like your digital name as a developer in X-Cart app store. The following names are reserved by X-Cart team and cannot be used if you are a 3rd-party developer:
- CDev
- XC
- QSL
- Qualiteam
Module ID is basically the name of your addon in the system, e.g. AustraliaPost or ProductFilter. This name must be unique across your other addons under the same developer ID
The identifiers must begin with an uppercase letter and may consist of a maximum of 64 alphanumeric characters.
Manual addon creation
Create a directory
classes/XLite/Module/<YOUR-DEVELOPER-ID>/<YOUR-MODULE-ID>/
inside your installation using your own developer and module IDs instead of the<YOUR-DEVELOPER-ID>
and<YOUR-MODULE-ID>
parts of the path.Create
main.yaml
file inside the folderclasses/XLite/Module/<YOUR-DEVELOPER-ID>/<YOUR-MODULE-ID>/
with the following content:version: 5.4.0.0
type: common
authorName: 'Your Developer display name'
moduleName: 'Example custom addon'
description: 'Description plain text'
minorRequiredCoreVersion: 0
dependsOn: { }
incompatibleWith: { }
skins: { }
showSettingsForm: false
canDisable: trueSet your own module description, addon name and addon author in the corresponding fields.
Re-deploy your store via the Admin area of your X-Cart:
After the re-deployment process is over, your module will show up among the installed modules in My Addons area.
However, this addon is not activated yet, and you need to enable it before it starts working.
You can download an example of the simplest X-Cart module here:
main.yaml options format
Here is the list of the field options along with their short descriptions:
version (required)
The addon’s version. It should contain four numbers with the point delimiters between them (e.g. 5.4.0.0). Read more about X-Cart version system here.
type (optional, default type is ‘common’)
The addon’s type. (e.g. common, payment, shipping, skin)
authorName (optional, default author name is the ‘author’ value from the module namespace)
The author’s display name (the one that the end user sees)
moduleName (optional, default module name is the ‘name’ value from the module namespace)
The addon’s display name. (the one that the end user sees)
description (optional)
The description of the addon.
minorRequiredCoreVersion (optional, default value is ‘0’)
The minimal minor core version that is required to install the addon (the third number, e.g. if v5.4.1.0 or higher is required, you should input ‘1’)
dependsOn (optional, the list is empty by default)
The list of addons, that are required for your addon
incompatibleWith (optional, the list is empty by default)
The list of addons, that cannot be active while your addon is enabled (means they are incompatible)
skins (optional, the list is empty by default)
showSettingsForm (optional, default is false)
Set to ‘true’ if your addon has settings (should be specified in install.yaml file)
canDisable (optional, default is true)
Set to ‘false’ if you want to remove an option to temporarily disable your addon. Such addons can only be removed/uninstalled completely.
Packing up your addon
If you want to create the module's distributive pack, you need to:
- Edit your
<X-Cart>/etc/config.php
file and define thedeveloper_mode
option asOn
there. - Go to admin area and click on the My Addons link in the sidebar.
- After that you will see the Pack it icon near each module in My Addons section of the maintenance panel as shown on the screenshot below:
- Clicking the icon shown on the screenshot will generate your module's distribution pack.