The system contains and every day receives orders from different stores with their own number, and the system itself generates order numbers.
Next, let's look at how to set up a number generation template to distinguish between manual orders and orders received via API.
{id}
- identifier of the order created from the system. Based on the id, the order number is generated according to the specified template. To highlight such orders, add a letter / word before or after the identifier. For example, like this: СRM{id}
or like this: {id}С
.
The second field "Template for generating order number from API" suggests making a template for order numbers received via API (for example, from an online store).
External code {external_id}
can be used for template of order numbers from API.
Thus,for orders coming through the API, you can:
- transfer the number directly from the store (fill in the
number
field when creating an order); - use an external identifier from the store as a number, setting the template
{external_id}
; - use our internal id as a number, setting the template
{id}
. This case is continuous numbering for all stores.
What order number is assigned by the system if the order came from an online store?
The system assigns for an order from any store the number assigned in the store itself.
- You can transfer the number using the
order[number]
field. - If the number is not transferred from the store, the number generation template in the system settings is used.
If different stores contain the same order numbers, then two orders with the same number will be uploaded to the system. A conflict in the system will not occur due to a different value in the "Store" field for orders.
How to prevent a situation when orders with the same numbers come from different stores?
In order for orders to come from different stores with unique numbers, it is necessary to set templates for generating order numbers on the store side.
So, in the 1C-Bitrix system, starting from version 12.5, you can create a template by which orders will be numbered. In the left panel of the 1C-Bitrix administrative interface, go to the "Online store" section. Next, find the field "Order number generation template" at the bottom of the "Service settings" block.