Is There A Way To Have Order Status Changes Update The Last_Modified Timestamp?

Hi,



So our 3rd party shipping software reads this field on the orders when it imports them. However, if for some reason we have to make a change to the status, the shipping software ignores it because it knows it’s already imported it by looking at the last time the shipping software did the import and it compares the order number and last_modifed date on the order. If it recently imported it and the last_modified date hasn’t changed, it ignores it.



I get it, we don’t want to keep importing a ton of orders only to discard them for existing.



However, what I’d like to be able to do is upon changing the status of an order, have CS-Cart update the last_modified date. Maybe there is a reason this can’t (or shouldn’t) be done that i’m not aware of.



If we can’t do it this way, does anyone know what actions we can do to force a change to the last modified date (i.e. add a “Staff only comment” etc. and save the order.)



So far, can’t get anything to update it.



Thanks!

I do not see the last_modified column in the cscart_orders table. If it exists in your store, you can open the app/functions/fn.cart.php file, find the fn_change_order_status php function and replace:



db_query("UPDATE ?:orders SET status = ?s WHERE order_id = ?i", $status_to, $order_id);




with



db_query("UPDATE ?:orders SET status = ?s, last_modified = ?i WHERE order_id = ?i", $status_to, TIME, $order_id);

Or you can use a change_order_status hook so you can survive upgrades.

[quote name=‘tbirnseth’ timestamp=‘1418968254’ post=‘200294’]

Or you can use a change_order_status hook so you can survive upgrades.

[/quote]



Thank you both! Surviving upgrades is probably a necessity :grin:

[quote name=‘YFinder’ timestamp=‘1419788497’ post=‘201144’]

Thank you both! Surviving upgrades is probably a necessity :grin:

[/quote]



You are welcome!