# OpenCart Connection

Integration allows the bot to get up-to-date information about products and orders directly from OpenCart, help the customer with the choice and execute confirmed orders.

OpenCart connects as a data source and a set of actions. Customer messages through this integration in ChatRex do not arrive: the client continues to write a bot through a connected messenger, CRM or chat.

## Requirements

- OpenCart **3.0.4.1** or **4.1.0.0**
- public address of the store with HTTPS;
- extension of PHP cURL;
- an active ChatRex account;
- Configured in OpenCart payment and delivery methods.

## Installation of the module

1. In OpenCart Marketplace, download the ChatRex package for your version:
   - **OpenCart 3.0.4.1**;
   - **OpenCart 4.1.0.0**.
2. In the OpenCart panel, open **Extensions>Install extensions**.
3. Download the `chatrex.ocmod.zip` package.
4. Go to **Extensions>Extensions>Modules**.
5. Find **ChatRex** and press **Install**.
6. Open the module settings and press **Connect ChatRex**.
7. Log in to ChatRex and confirm the store’s connection.
8. Turn on the module and save the settings.

!!!warning
Use the package for your main version of OpenCart. OpenCart 3 and OpenCart 4 are not interchangeable.
!!!

### OpenCart 3

### OpenCart 4

Once connected, the store will appear in **Integrations** in ChatRex.

## Actions bot

Add the necessary operations in the tab **Integrations and actions**. Finding and receiving goods, receiving orders and creating new orders are described in the article [**Actions OpenCart**](<../../actions/integrations/opencart.md>).

## Verification

1. Make sure that OpenCart appears on the ChatRex Connected Integration list.
2. Find a test item and compare the price and balance with the store.
3. Get an existing test order by his number.
4. Before checking the order creation, specify in action the codes of payment and delivery methods.
5. Create a test order only after explicit confirmation of its composition and conditions.

!!!warning
Creating an order changes the actual store data. Do not re-start the action with an unknown result: first check the order in OpenCart.
!!!

## Security of connection

- The directory is not copied to ChatRex – the bot requests relevant data directly from OpenCart.
- OpenCart Administrator Password is not transmitted;
- Requests are signed by HMAC-SHA256 and contain a time stamp and a one-time identifier.
- Repeated orders are protected from duplication.
- After disabling the integration, the store stops accepting ChatRex requests.
