Magento – Customer Deleted; Get old Order History back

customermagento-1.9

Customer deleted in Magento from Backend accidentally.

Created a new Customer in Magento Backend to recover Customer.

But how to add the old Order History?

UPDATE
sales_flat_order
SET customer_id = 12345
WHERE
customer_email = 'customer@example.org'

Old Order now has the new customer_id but Magento Backend does not show this Order in Order-History???

Q: How to connect Orders to a Customer in SQL??

Best Answer

You have to update sales_flat_order_grid too:

UPDATE
sales_flat_order_grid
SET customer_id = 12345
WHERE
customer_email = 'customer@example.org'
Related Topic