Sync Flow
Products are synced from Crystal to the integration providers. When the sync process runs, it looks for products marked for e_commerce that have been updated since the last sync, or beginning of time if no prior successful sync has been recorded.
Orders are synced from the integration providers to Crystal. The primary mechanism for syncing is the use of webhooks. When orders are created, typically with a paid or completed/fulfilled status the e-commerce middleware receives a webhook notification. The order is then duplicated in Crystal, and its id tracked. During normal sync, any orders completed since the prior sync are retrieved from the integration provider and their ids are compared against the tracked ids handled by the webhooks. This serves as a backup mechanism for capturing any orders that may have been missed due to a failed webhook.
Crystal E-commerce Product
This is the model returned from the Crystal api ecom/products endpoint that is used to sync products to our integration partners.
Crystal Ecom Product | Crystal DB table/column |
id | products.uuid |
product_number | products.reference |
name | products.ecom_title |
description | products.ecom_description |
short_description | products.ecom_short_description |
images | queried (getAttachments) via products.ecom_images |
tags | products.ecom_tags |
allow_backorder | products.ecom_allow_backorder |
quantity | calculated from sku_transactions |
is_visible | calculated => account.include_on_ecom & product_type.include_on_ecom.
Note: always true because the query only returns rows where both of these conditions are true.
|
vendor | object: {
id : accounts.uuid
name : accounts.ecom_name
code : accounts.code
} |
price | products.price |
item_type | object: {
id : product_types.uuid
name : product_types.name
} |