1

we have set up a cron job that cleans off old orders for our Magento 1.4 shop. Stuff like failed payments, incomplete finance applications, stuff like that are checked and of older than x days, we change the status.

The cron job basically runs an SQL query that directly edits the sales_flat_order table in the database and changes the state/status according to our criteria.

My problem is that because we've made these changes via the back door, these changes aren't reflected in the sales_flat_order_grid table and therefore the orders grid view in the admin until you go into an order and save some part of it.

Is there some way I can force the sales_flat_order_grid to refresh/rebuild based on the contents of the sales_flat_order table?

Thanks, James

DWJames
  • 33
  • 1
  • 7
  • 1
    see this: http://stackoverflow.com/questions/6482642/in-magento-how-do-i-populate-a-new-column-in-sales-order-grid-with-data-from-sa?rq=1 – Enrique Jun 28 '12 at 23:09

1 Answers1

1

Just had to do this recently here is a few lines that should do that job:

    //update status sales_flat_order_grid
    $vals = array();
    $vals['status'] = $status;
    $where = $write->quoteInto('entity_id =?', $order_id);
    $write->update("sales_flat_order_grid", $vals ,$where);
Gershon Herczeg
  • 3,016
  • 23
  • 33