After migrating from 2.1.8 to 2.2.0, SALES > ORDERS grid does not update order statuses.
It does updates the status on the invoice, but not on the sales order grid. Now, we are unable to do accurate sort or filter by status.
This issue is not cache related, I unsuccessfully tried to clear, flush, re-indexed, restart the server.
Also, I looked in database and found sales_order table has "complete" status, but sales_order_grid still has "processing" status with the same entity_id. Even after manually changing value to "complete" in sales_order_grid, it is still showing "Processing" at the admin "UI".
In case if I only one with this issue, and this can't be replicated, can someone from Magento 2 Gods guru tell me which tables are responsible for displaying the order status on the grid UI, I will probably run a CRON job to sync the values?
Thank you
@moderncodes, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9
We have similar problem (Magento 2.2), except our orders are "stuck" in pending mode.
Just as a temporary solution until I figure out what is wrong on my end, I ended up running this query.
UPDATE sales_order_grid as t1
LEFT JOIN sales_order as t2
ON t1.entity_id = t2.entity_id
SET t1.status = t2.status
WHERE t1.status != t2.status;
I know I mentioned in my original question that updating sales_order_grid was not working, so for whatever reason, maybe by my mistake, but this time it updated ORDER GRID page with correct order statuses.
@magento-engcom-team thank you for taking your time testing it.
When I'll have enough time and find the permanent fix, I will post it here in case someone will run in to the same issue.
We have the same problem, @moderncodes temporary fixed helped us.
After some investigation I saw that number of records in cron_schedule with status = 'pending' is increasing instead of decreasing.
There is a lot of jobs like : catalog_product_outdated_price_values_cleanup
In vendor/magento/module-catalog/etc/crontab.xml I see that it is run every minute. Can we run it less often?
yeah... that just doesn't work reliably it seems:
MariaDB [mydb]> SELECT sales_order_grid.status, sales_order.status, count(*) FROM sales_order_grid JOIN sales_order ON sales_order_grid.entity_id = sales_order.entity_id WHERE sales_order_grid.status != sales_order.status GROUP BY sales_order_grid.status, sales_order.status;
+-------------------------+-------------------------+----------+
| status | status | count(*) |
+-------------------------+-------------------------+----------+
| pending | canceled | 2 |
| pending | complete | 1 |
| pending | processing_exported | 87 |
| pending | processing_pickup_ready | 9 |
| pending_payment | canceled | 7 |
| pending_payment | processing_exported | 20 |
| processing_pickup_ready | complete | 3 |
+-------------------------+-------------------------+----------+
8 rows in set (0.78 sec)
after updating 2.1 to 2.2.1, this has become even worse.
I'm having the same issue in 2.2.1.
Could this be related to issues with the cron? In my case, the website missed a few cron runs and now I see "Too late for the schedule" repeatedly in cron_schedule. The cron is fixed but now there should be a way of processing these pending items.
even when cleaning the "too late for schedule" entries, the status would not get reliable updated in our case.
I've added a cli command that executes the following query and am running it in a cron:
UPDATE sales_order_grid JOIN sales_order ON sales_order_grid.entity_id = sales_order.entity_id SET sales_order_grid.status = sales_order.status WHERE sales_order_grid.status != sales_order.status;
I've found that cron jobs were not running properly and they were just spawning and running in loops and was raising load on the server. I've cleared entries from cron_schedule table that were causing these loops and load looks much better, plus cron jobs are actually executing now, all cron _job_codes_ have success status.
Unfortunately, I can confirm, fixing cron did not fixed my original issue. I still manually updating my sales_order_grid statuses daily with the query I provided above.
Magento 2.2.1
I'm having the same issue in 2.1.8.
Our orders are "stuck" in pending mode.
This is value in my sales_order table http://joxi.ru/ZrJkP8WS158GRm
And this is value in my sales_order_grid table: http://joxi.ru/GrqGnO6uNlDEq2
Anybody have any news about this issue?
I'm having the same issue after adding a new custom column to the sales_order_grid.
sales_order status is not propagated to the grid.
This issue should be reopened @magento-engcom-team.
I'm currently working under magento2.1.9.
You can reproduce this issue by creating a module with:
/Module/Vendor/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid" type="Magento\Sales\Model\ResourceModel\Grid">
<arguments>
<argument name="columns" xsi:type="array">
<item name="fastmag_status" xsi:type="string">sales_order.fastmag_status</item>
</argument>
</arguments>
</virtualType>
</config>
and in /Module/Vendor/view/adminhtml/ui_component/sales_order_grid.xml
<?xml version="1.0"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="sales_order_columns">
<column name="fastmag_status">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="visible" xsi:type="boolean">true</item>
<item name="label" xsi:type="string" translate="true">Fastmag</item>
</item>
</argument>
</column>
</columns>
</listing>
At module install
$connection
->addColumn(
$setup->getTable('sales_order'),
'fastmag_status',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'length' => 255,
'nullable' => true,
'default' => 'standby',
'comment' => 'Exported to Fastmag'
]
);
$setup->getConnection()->addColumn(
$setup->getTable('sales_order_grid'),
'fastmag_status',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'length' => 255,
'nullable' => true,
'default' => 'standby',
'comment' => 'Exported to Fastmag'
]
);
Same issue M2.2.2 EE
same issue with 2.2.1 order status in order page is correct, order status in order grid is not updating.
Signifyd fraud protection is same, good in order page , blank in order grid
Had same problem on 2.2.1. Upvoted answer is a short term fix, but still need permanent solution.
temporary solution as below.
make one file in root name "order_grid_init.php"
code below
require __DIR__ . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('RunUpdate');
$bootstrap->run($app);
create second file in root . name "RunUpdate.php"
class RunUpdate extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface{
public function launch()
{
//here I called object name of product for print on browser
//you can place your logic here
//echo get_class($this->_objectManager->create('\Magento\Catalog\Model\Product));
//below method use to return response
//return $this->_response;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get("Magento\Framework\App\ResourceConnection");
$connection = $resource->getConnection();
$sql = "UPDATE sales_order_grid as t1 LEFT JOIN sales_order as t2 ON t1.entity_id = t2.entity_id SET t1.status = t2.status WHERE t1.status != t2.status";
$connection->query($sql);
return $this->_response;
}
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
{
return false;
}
}
create new cron run this "order_grid_init.php" after every five minit.
Can someone re-open this? I'm having the same issue, and the cron fix above does work. My columns added in sales_order_grid.xml are not being copied across. They're all blank.
I not sure if I can reopen the issue, which has been closed by @magento-engcom-team .
Maybe need to create new one than reference this one?
Most helpful comment
Just as a temporary solution until I figure out what is wrong on my end, I ended up running this query.
UPDATE sales_order_grid as t1 LEFT JOIN sales_order as t2 ON t1.entity_id = t2.entity_id SET t1.status = t2.status WHERE t1.status != t2.status;I know I mentioned in my original question that updating
sales_order_gridwas not working, so for whatever reason, maybe by my mistake, but this time it updated ORDER GRID page with correct order statuses.@magento-engcom-team thank you for taking your time testing it.
When I'll have enough time and find the permanent fix, I will post it here in case someone will run in to the same issue.