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:
INSERT INTO `xcart_modules` (`module_name`, `module_descr`, `active`) VALUES('Modulename', 'Module description', 'N');
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:
INSERT INTO xcart_config (`name`,`comment`,`value`,`category`,`type`,`defvalue`) VALUES('unique_input_name','Brief description','','Category','input_type',1);
Now each config row you add means one configuration item and are available as:
Latest posts by alexey (see all)
- Zend Soap NULL Reponse - August 29, 2018
- Quick Facts About WooCommerce - April 25, 2018
- WordPress stuck on a “Too many redirects” error loop when using SSL - January 17, 2018