Magento V2 Order Status XML
The XML format documented here is used to update order statuses in Magento, and optionally add a comment to the order, via the Import Order Status Updates to Magento V2 task.
Sample XML
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfOrderStatusHistory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OrderStatusHistory>
<external_id>185754</external_id>
<parent_id>1</parent_id>
<parent_increment_id>000000001</parent_increment_id>
<status>processing</status>
<comment>Order imported into Sage</comment>
<is_customer_notified>0</is_customer_notified>
<is_visible_on_front>1</is_visible_on_front>
</OrderStatusHistory>
</ArrayOfOrderStatusHistory>
Order Status History
| Magento Field | XML Field | Type | Input | Notes |
|---|---|---|---|---|
| Order | parent_id* | int | Conditional | The Magento entity ID of the order to update |
| Order | parent_increment_id* | string | Conditional | The Magento order number, e.g. 000000001 |
| Status | status | string | Required | The code of the status to set, e.g. processing. See below |
| Comment | comment | string | Optional | The comment to add to the order history |
| Notify Customer by Email | is_customer_notified | int | Optional | 0 for false, 1 for true |
| Visible on Storefront | is_visible_on_front | int | Optional | 0 for false, 1 for true |
| - | entity_name | string | Optional | The entity the comment belongs to, e.g. order |
| - | created_at | DateTime | Optional |
- parent_id*, parent_increment_id* - One of these is required to identify the order being updated
At least one of parent_id and parent_increment_id must be supplied to identify the order.
- status - the status codes on a standard Magento installation are listed below. Stores often add their own custom statuses, so check the status codes on your own store before mapping them.
| Code | Meaning |
|---|---|
| pending | Pending |
| pending_payment | Pending Payment |
| processing | Processing |
| complete | Complete |
| closed | Closed |
| canceled | Canceled |
| holded | On Hold |
| payment_review | Payment Review |
| fraud | Suspected Fraud |
Magento will only accept a status which belongs to the state the order is currently in, so an order cannot be moved from complete back to processing.
Common Fields
The following fields are supported on every record we import into Magento. They are used by Zynk rather than sent to Magento.
| XML Field | Type | Input | Notes |
|---|---|---|---|
| external_id | string | Optional | The unique ID of the record in the external system. Stored in Zynk's internal DB and used to track records already imported. Required when the Prevent Reprocessing setting is enabled on the task |
| store_code | string | Optional | The store view code to send this record to, overriding the Store View Code setting on the task for this record only |
| match | element | Optional | Match an existing record on a field and value other than the default. See Matching Records in Magento v2 |
| matches | element | Optional | As match, but matching on more than one field. See Matching Records in Magento v2 |
Errors
Records which fail to import are written to the Fail File in the same format as the input file, with the reason for the failure added in an errors element. There is no need to send this element yourself.
The name of each error tells you at which stage the record failed:
| Name | Meaning |
|---|---|
| Pre-Validation | Zynk checked the record before sending it and found a problem, e.g. a required field is missing or a related record could not be found. The record was not sent to Magento |
| Prevent Reprocessing | A record with the same external_id has already been imported, and the Prevent Reprocessing setting is enabled on the task |
| Error | Magento rejected the record, or Zynk could not match the record to the data already in Magento. The description contains the message returned by Magento |
| Upload Error | An unexpected error occurred while sending the record to Magento |