Understanding and diagnosing Magento 2 order status updates
This guide was written to assist when changes to orders in Magento 2 such as shipping and tracking don't flow back to Amazon and eBay via Codisto LINQ.
How it works
Order updates in Magento 2 are tracked via Materialized Views, where Codisto LINQ subscribes to order updates. Any changes made in the subscribed tables will write the Order Entity ID to the specified Change Log table. Following is the mview.xml definition for orders:
<view id="codisto_index_order" class="Codisto\Connect\Model\Indexer\Marketplace" group="indexer">
<table name="sales_order" entity_column="entity_id" />
<table name="sales_invoice" entity_column="order_id" />
<table name="sales_shipment" entity_column="order_id" />
<table name="sales_shipment_track" entity_column="order_id" />
It is defined in the mview.xml file:
Installing the plugin registers these Materialized Views in Magento and creates the change log table, in this case codisto_index_order_cl. Any change to the sales_order, sales_invoice, sales_shipment or sales_shipment_track table will write the order identifier into the change log table (entity_id in sales_order and order_id in the others).
So a change to an order which affects any of the subscribed tables will see it's ID show up in codisto_index_order_cl. Keep in mind that when Codisto LINQ runs an incremental synchronisation, it will pick up these orders and delete the records from codisto_index_order_cl, so don't be surprised to see them disappear fairly quickly.
The incremental synchronisation function of the plugin is here:
It reads the orders from the codisto_index_order_cl change log table here:
It then goes on to process the changes.
Watch the codisto_index_order_cl table as you make a change to an order. The Magento entity id of that order should show up in that table immediately and disappear within 10 minutes at most.
What if the change log doesn't get populated?
Check your Magento 2 Materialized Views to ensure they are working correctly. Ensure the change log table exists. If not, inadequate database permissions may have blocked the creation of the table.
What if the change log doesn't empty?
That would indicate a broader synchronisation problem, possibly caused by things such as incorrect host, firewall blocking our access or other Magento environment issues. You can request a diagnostic link from our customer service team (email@example.com) to assist with troubleshooting. Please also see Verifying / Troubleshooting Magento Configuration
What if the change log fills and empties but shipment status doesn't flow to Codisto LINQ?
That might indicate the shipment and tracking information are not stored in Magento's default database fields. You can check the status in the Codisto LINQ Marketplace Orders screen.
This article has references to the GitHub repository for the Codisto LINQ Magento 2 plugin. To keep the links consistent, specific links to version 1.91.24 were included. Some code may change slightly in subsequent versions, but the concepts will remain the same.