Working with X-Cart externally
page last edited on 17 April 2015
Imagine the situation that you want to pull some info from X-Cart and then display it in your blog software. In this case, you need to initialize X-Cart and then somehow call one of its functions. This article describes how you can achieve it.
Table of Contents
test.php file in X-Cart’s root with the following content:
<?php //X-Cart initializtion require_once 'top.inc.php';
Now X-Cart is initialized in this file and we can start using its functions here. Add the following line into this file:
and it will display company name from X-Cart settings.
The entire code of our
test.php file is:
<?php //X-Cart initializtion require_once 'top.inc.php'; // displaying company name echo \XLite\Core\Config::getInstance()->Company->company_name;
Help make this document better
This guide, as well as the rest of our docs, are open-source and available on GitHub.