Skip to main content
page last edited on 17 April 2015

Working with X-Cart externally

Version: 5.4 and early

Introduction

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.

Implementation

We create 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: 

echo \XLite\Core\Config::getInstance()->Company->company_name;

and it will display company name from X-Cart settings.

Full code

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;