# MODX + miniShop2

ChatRex Commerce Bridge synchronizes **published miniShop2 products** with ChatRex. Your assistant can find products, check prices and availability, and share storefront links. The integration is **read-only**: it does not transfer customers, orders or payments, and does not modify your MODX catalog.

## Before installation

- Use **MODX Revolution 2.8.x** (tested on 2.8.9-pl), **miniShop2 4.4.2-pl or later in the 4.x series**, **PHP 8.1+**, MySQL and cURL. **MODX 3 and MiniShop3 are not supported** by this release.
- Check your installed miniShop2 version. [miniShop2 on modstore](https://modstore.pro/packages/ecommerce/minishop2) provides the required 4.x release; another catalog may offer an older version.
- You need administrator access to install MODX packages and configure a scheduled PHP task, a public HTTPS storefront, and outbound HTTPS access to `app.chatrex.pro`.
- The MODX Extra is free to download. Using the connected catalog requires a separate **ChatRex subscription for MODX Commerce**. Review the current subscription terms in ChatRex.
- Back up your MODX files and database before installing or updating.

## Install and connect

1. In MODX Manager, open **Extras → Installer → Download Extras**. Find **ChatRex Commerce Bridge** in the official repository. Check the [published package and supported versions](https://extras.modx.com/package/chatrexcommercebridge).
2. Download and install the package, then open **Extras → ChatRex Commerce Bridge**.
3. Set **Public storefront URL** to your public HTTPS store address, without credentials, query parameters or a fragment. Set **MODX context** to the context containing your published products, and **Currency** to the store's three-letter currency code, such as `USD`.
4. In [ChatRex](https://app.chatrex.pro), open **Integrations**, select **MODX + miniShop2**, and generate a one-time pairing code.
5. Paste it into **One-time pairing code** in MODX. Review and select **I agree to send published product data to ChatRex**, then select **Connect**.
6. Confirm **Connected**, select **Sync now**, and verify the successful synchronization and product count. The selected context must contain published miniShop2 products.

If the code expires or has already been used, generate a new one in ChatRex. Never share your MODX administrator password or pairing code with customers.

## Keep the catalog updated

Ask your hosting administrator to run this command every five minutes, replacing the PHP and MODX paths with your server's paths:

```sh
*/5 * * * * /usr/bin/php /path/to/modx/core/components/chatrexcommercebridge/cron.php
```

Temporary network failures remain queued for retry. **Sync now** runs a manual full synchronization. Answers use the last successfully synchronized catalog, so a recent store change may not be reflected until synchronization completes.

## Configure your assistant

Open your bot's **Integrations and actions** and add the required [MODX Commerce actions](../../actions/integrations/modx.md). Select the connected store for each action. Give the bot instructions about which products it should recommend and when it should hand a question to your team.

Ask about a known test product and compare its price, currency, availability and link with the storefront. If stock tracking is disabled, do not promise an exact quantity.

## Add a chat channel

**This Extra does not install a chat widget on your website.** To chat with visitors, separately connect [Online Chat](<../channels/Online Chat.md>), allow the storefront domain, install the chat code on the website and assign the channel to your bot. You can also assign another supported channel in ChatRex.

## Disconnect or uninstall

Select **Disconnect** in the MODX component while ChatRex is reachable. This revokes the connection and stops synchronization. Then uninstall the Extra through **Extras → Installer** if needed. Your miniShop2 products and orders remain. Generate a new pairing code to reconnect.

## Troubleshooting and support

If connection fails, check the supported MODX and miniShop2 versions, storefront HTTPS address, context, currency, cURL, and outbound connection to ChatRex. If products are missing, check that they are published in the selected context and run **Sync now**. For delayed updates, check the scheduled task and last successful sync.

Contact [support@chatrex.pro](mailto:support@chatrex.pro) for assistance. Include the package version and the visible error, but do not send passwords, pairing codes or private configuration files.
