
Trigger on order status change
Creating the trigger
Goal: detect order status changes in RetailCRM and send that information to the site.
Create a new trigger in RetailCRM. Name it e.g. changeStatus.
Set event: Order change.
Set condition (when the trigger runs):
phpchangeSet.hasChangedField("status") and changeSet.getNewValue("status")Set action: HTTP request.
Set URL: your site (e.g.
https://site.ru/). For MODX, use the site root or homepage.Method: POST.
Request parameters:
Name Value retailCRM_action change_statusstatus {{order.getStatus().getCode()}}order_id {{order.getExternalId()}}Save.
When the order status changes in RetailCRM, a POST request is sent to the site with these parameters.
Handling on the site
The modRetailCRM plugin receives the request, finds the order by ID and sets the corresponding status. Ensure in miniShop2 that each order status has the RetailCRM status code set, and that modretailcrm_sync_statuses is filled in modRetailCRM system settings.
