# Connecting CS-Cart

Integration transfers an active directory of the selected CS-Cart storefront to ChatRex. The bot will be able to search for goods, take into account options and combinations, check prices and balances and send the buyer a link to the product.

CS-Cart connects as a data source, not a channel. Buyers and orders through this integration are not transferred to ChatRex.

## Before connecting n

Prepare:

- CS-Cart Administrator rights to install the add-on;
- activated addition **ChatRex**;
- the selected company or seller, showcase, language and currency;
- server cron for background submission of directory changes.

The add-on only works to read the directory data from ChatRex. The connection area is fixed when pairing: the bot does not mix the goods of different sellers, showcases, languages or currencies.

## Installation of the supplement

1. Find the **ChatRex** add-on in the CS-Cart Marketplace or use the installation package provided for your CS-Cart version.
2. Install and activate the add-on in the admin panel.
3. Set up a minute-by-minute `chatrex_cron.php` file launch on the store server. The path to PHP and the CS-Cart directory depends on the server configuration.

Example of the cron team:

```cron
* * * * * /usr/bin/php /path/to/cscart/chatrex_cron.php 50
```

If you do not have access to cron, pass this step to the server administrator or hosting provider. Without a background job, directory changes won’t come regularly to ChatRex.

## Connection

1. In ChatRex, open **Integrations**.
2. Press **Connect integration**, select **CS-Cart** and press **Connect**.
3. On the **Connection installation** tab, click **Generate code**.
4. In the CS-Cart panel, open **Marketing → ChatRex**.
5. Choose a company or seller, showcase, language and currency.
6. Read the terms of data transfer and confirm your consent.
7. Enter a one-time code from ChatRex and press **Connect**.
8. Return to ChatRex and wait for **Connected** status.

The code is valid until the time specified below it. If the deadline expires, press **Update code** and reconnect.

Once connected, ChatRex displays the company, showcase, language and currency. Check them before setting up the bot actions.

## What's in sync

- active and visible products of the selected showcase;
- categories and articles;
- prices and currency;
- Options and combinations;
- availability and quantity in stock;
- Public references to goods.

Changes first fall into the local add-on queue, then are transmitted to ChatRex by the background task. A short delay after changing the product is normal.

## Actions bot

After connecting, add the necessary operations in the tab **Integrations and actions**. Their parameters and recommended sequence are described in the article [**Actions CS-Cart**](<../../actions/integrations/cscart.md>).

## Verification

1. Choose an active product with several options or combinations.
2. Find it through ChatRex test chat.
3. Compare the name, article, price and options with the selected storefront.
4. Check the remainder of a particular combination.
5. Get a public link and make sure it opens the item in the right storefront.

## Shutdown

Open the CS-Cart integration settings in ChatRex and click **Unplug**. Disabling revokes the connection; waiting to send a directory change is no longer transmitted.

To reconnect, create a new code and re-select the data area in CS-Cart.
