X-Cart:Top.inc.php

From X-Cart 4 Classic
Jump to: navigation, search

The configuration file top.inc.php is a plain text file located in the X-Cart root directory. It keeps global definitions and directives for the operating environment of the installed copy of the X-Cart software. The values of the variables inside the top.inc.php file must be edited very carefully, because these settings affect the general operating capability of your store.

The instructions below aim at helping you understand what some of the variables answer for, so that you could configure your store correctly.

Directories structure definitions

$xcart_dir = realpath(dirname(__FILE__));

The variable $xcart_dir keeps the location of the directory where X-Cart is installed. By default its value is set to ‘realpath(dirname(__FILE__))’, where __FILE__ is the PHP constant representing the absolute filepath to top.inc.php. On some operating systems the __FILE__ constant can be set up in a way that makes it impossible to define the location of the X-Cart installation directory. For example, on SunOS the constant _FILE_ for included files contains a relative filepath instead of the absolute filepath . As a result of this, the value of the variable $xcart_dir sets to '/' which is wrong.

If a similar problem causes errors on your server (e.g., if you keep getting error messages saying “Cannot include file”), change the value of $xcart_dir manually by replacing the ‘realpath(dirname(__FILE__))’ part with an actual path to your X-Cart installation.

Example:

$xcart_dir = ‘/home/user/public_html/xcart’;

Directories location definition

define ('DIR_CUSTOMER', '');
define ('DIR_ADMIN', '/admin');
define ('DIR_PROVIDER', '/provider');
define ('DIR_PARTNER', '/partner');

This section is used to define the locations of script repositories for different X-Cart interfaces (Customer, Administrator, Provider and Partner areas). By default the scripts that control the Customer area are located in X-Cart root directory, the scripts that control the Admin and Provider areas are located in directories /admin and /provider, respectively. If you use a copy of X-Cart together with the X-Affiliate add-on module, the X-Cart root directory includes the directory /partner containing the scripts that control the Partner area.

If necessary, you can change the locations of the script repositories by editing the values of the respective constants.

Example 1:

If your copy of X-Cart is installed to /home/user/public_html/xcart, the script files for the Customer area are located in the X-Cart root directory and the Customer area is available at http://www.example.com/xcart, the DIR_CUSTOMER constant must be set up as follows:

define (’DIR_CUSTOMER’, ’’);

Example 2:

If your copy of X-Cart is installed to /home/user/public_html/xcart, the script files for the Customer area are located in the folder customer/ and the Customer area is available at http://www.example.com/xcart/customer, the DIR_CUSTOMER constant must be set up as follows:

define (’DIR_CUSTOMER’,/customer’);

Example 3:

If your copy of X-Cart is installed to /home/user/public_html/xcart, the script files for the Admin and Provider areas are located in the folder my_admin/ and my_provider/, and the Admin and Provider areas are available at http://www.example.com/xcart/my_admin and http://www.example.com/xcart/my_provider respectively, the DIR_ADMIN and DIR_PROVIDER constants must be set up as follows:

define (’DIR_ADMIN’,/my_admin’);
define (’DIR_PROVIDER’,/my_provider’);