Creating a module in X-Cart 4.4

X-cart is an extensive e-commerce store built and supported by good old PHP. I had a chance to work with it and i had to develop a custom module for a CRM integration. 

Now for a software which has been there for quite some time, you expect it to have a large community and great technical support. But, i was able to find none since it seemed like most of the people were shifting to the version 5 and they did’nt care about the old one.

But i had to do it and doing it in 4.x version was one of the requirement. So, i dig around for help material about creating a module in x-cart 4 but i was not able to find much help.

After some hit and trial and having a look at some other community modules, i found the way how it works. Here is what i did:

You create a folder in modules folder and create two files in it:

Config.php is supposed to hold all you configuration variables and script inclusions and func.php is included in this file to be available to the whole system. func.php is where most of your module code lies in the form of PHP functions you can use anywhere in the whole system.

Now, your new module is created but it will not appear as long as you don’t put the module row in the database. Execute the following:

The query is self-explanatory and it now when you access backend you will see the module appear in the listing.

Now you would see that other modules have configuration links appearing along. To have a configuration link and page you will have to add configuration row into database as below:

Now each config row you add means one configuration item and are available as:

This was just an intro(maybe not even that) to how x-cart modules work and it by no means is official and most authentic way to do things but it’s how i made it work:).
alexey

alexey

Application developer, movie buff, occasional reader and a huge Manchester United fan.
alexey
Share

Application developer, movie buff, occasional reader and a huge Manchester United fan.