# OpenCart

With OpenCart connected, the agent recognises a customer from the number they call from, reads back their recent orders and order status, answers product questions (optionally narrowed to a manufacturer) and, if you allow it, creates the order in the store. **Integrations - Catalogue - OpenCart - Connect** opens the connect dialog. One connection is shared by every agent in the company.

  <ShotPlaceholder
    src="/assets/integrations/opencart.png"
    name="opencart-connect"
    alt="Connect OpenCart dialog with Store URL, API username, API key and API dialect"
    capture="Connect OpenCart dialog."
  />

## What you need before you start

OpenCart needs a REST extension and an API user. With the recommended Dreamvention REST Admin extension:

1. Install **Dreamvention REST Admin**, then **Extensions - Modifications - Refresh**.
2. **System - Users - API - Add new**: a username such as `voicelogica`, status **Enabled**, click **Generate** for the API key, **Save**, and copy the key.
3. Under **IP addresses** on the same API user, add the Voice Logica server IP. An empty list is only suitable for testing.
4. **System - Users - User Groups**: allow `extension/dreamvention_rest_admin/*`, plus Access and Modify on `catalog/product`, `catalog/manufacturer`, `customer/customer` and `sale/order`.

## What you enter

- **Store URL** (required) — The storefront root with `https://`, without `/admin` and without a trailing slash.
- **API username** (required) — The username of the API user.
- **API key** (required) — The key generated for that user.
- **API dialect** — Which REST extension the store uses: `dreamvention` (default and recommended), `journal` or `native`.
- **Store name** — Display name for the connection. Optional.

## First setup

1. **Integrations - Catalogue - OpenCart - Connect**, fill the fields, **Test connection**, then **Connect**. OpenCart appears under **Connected** and customers and products start copying in the background.

2. Open **My Agents**, pick the agent, then **Skills - Tools & Workflows**. Turn on **OpenCart** and click **Configure**.

3. Pick the operations. **Identify caller by phone** is on by default. Add **Get orders by customer** and **Search products** for order and product questions. Add **Create order** only if the agent should take orders, and set **Max order value** and **Max order lines**. **Custom order attributes** collected by the agent are added to the order comment.

4. Click **Save** in the settings window, then **Save** the agent.

5. Call the agent from a phone number saved on an OpenCart customer (or use **Try this agent**). Ask "Has my last order shipped?". The agent should greet you by name and read back the order status. Then ask for a product by name.

## What the agent can do

| Job | What happens on the call |
|-----|--------------------------|
| Recognise the caller | Matches the caller's number to an OpenCart customer. Can also find a customer by name or email and remember the number for next time. |
| Order questions | Reads the caller's recent orders or one order: status, totals, items. **Pre-fetch recent orders on call start** loads the last 10 orders before the agent speaks. |
| Product questions | Searches the catalogue, optionally by manufacturer, and reads one product's details. |
| Take an order | Creates the order in OpenCart within the limits you set. |

Customers and products are refreshed daily. **Sync now** on the OpenCart card under **Connected** refreshes them immediately.

## Troubleshooting

**Test connection fails with 401**

The API user is refusing the request, almost always because the Voice Logica server IP is not in the user's **IP addresses** list. Also check that the API user is **Enabled** and that the key was saved after **Generate**.

**Test connection fails with 404**

The REST extension's routes are not active. Go to **Extensions - Modifications** and click **Refresh**, then test again. Check that **Store URL** is the storefront root, not the `/admin` address, and that **API dialect** matches the installed extension.

**Customers or orders come back empty**

The API user's group lacks permission on `customer/customer` or `sale/order`. Add Access and Modify for those routes under **System - Users - User Groups**, then **Sync now**.

## Next Steps

[Get an integration working](https://docs.voicelogica.ai/integrations/) - company connection, then the agent tool.  
[Tools & Workflows](https://docs.voicelogica.ai/agent-configuration/built-in-tools/) - where the OpenCart tool is switched on.  
[PrestaShop](https://docs.voicelogica.ai/integrations/eshops/prestashop/) - [XML product feed](https://docs.voicelogica.ai/integrations/eshops/xml-feed/) - for stores on other platforms.
