Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011
    Posts
    15
    Plugin Contributions
    0

    Default Best way to merge two databases to preserve customers and orders

    Using v 1.5.5
    My host did a restoration of our website from two weeks ago due to a file being overwritten that we couldn't track down which caused the checkout process to loop (for new customers) and now checkout is working again. The problem is I was planning on restoring the database from the most recent version since orders have come in but we had new orders overnight that are now in the current db which I would prefer to preserve, but they have order numbers/etc that are duplicates now.
    So what is the best way to include the new orders into a restored version of yesterdays database files (with the newest orders)? Is it possible just to manually add the new entries in the orders and customers table using phpmyadmin or are there other tables of concern?

  2. #2
    Join Date
    Jul 2011
    Posts
    15
    Plugin Contributions
    0

    Default Re: Best way to merge two databases to preserve customers and orders

    I think I figured it out. For reference (my own included since I like to repeat mistakes).
    After making a backup of the current db I replaced the store database with the older one, thus replacing the new orders (there were only a couple so this seemed like the easier option) with the ones that were lost in the first backup restore. Then I just manually entered the missing order info into the various tables; in this case I believe they were orders, orders_products, orders_status_history, orders_total and paypal. There might be other db's affected, I used notepad ++ to find all occurrences of the order_id that I was inserting and then when putting together the sql insert command I updated the order id/order_products_id/order_status_history_id/etc with the current numbers (since the id numbers all had to be adjusted to account for the existing orders).
    Basically the older db was restored bringing back all orders from the last two weeks, then the individual db entries were added in phpmyadmin to the end of their respective tables so everything is almost fine I think.

  3. #3
    Join Date
    Jul 2012
    Posts
    14,558
    Plugin Contributions
    17

    Default Re: Best way to merge two databases to preserve customers and orders

    Thing about this is that:
    1) the email sent to the affected customer(s) indicates a different order number than currently assigned.
    2) there's no history in the admin history nor order history showing the change.

    There may be some other things to address that I've missed.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  4. #4
    Join Date
    Jul 2011
    Posts
    15
    Plugin Contributions
    0

    Default Re: Best way to merge two databases to preserve customers and orders

    Quote Originally Posted by mc12345678 View Post
    Thing about this is that:
    1) the email sent to the affected customer(s) indicates a different order number than currently assigned.
    2) there's no history in the admin history nor order history showing the change.

    There may be some other things to address that I've missed.
    That's true, you could always add an entry to the admin_history table to remedy that and yes the order number is different, that's the only noticeable and unavoidable byproduct of trying to fix it this way. In my case I printed out invoices for affected orders before the order number changed so they would only recognize the differences by logging into their accounts and comparing invoice numbers. I was unsure of another way to handle the situation, for me the small amount of affected customers (only orders placed overnight yesterday) was acceptable and I couldn't come up with a better solution in a short time frame.

 

 

Similar Threads

  1. v150 merge 2 store databases
    By richardtuttle in forum Customization from the Admin
    Replies: 4
    Last Post: 30 Sep 2012, 09:17 PM
  2. One customer, two accounts..merge orders?
    By LissaE in forum Managing Customers and Orders
    Replies: 5
    Last Post: 19 May 2010, 06:12 PM
  3. best way to import customers?
    By ebaobao in forum General Questions
    Replies: 5
    Last Post: 27 Aug 2008, 06:32 AM
  4. What is quick way to delete customers and orders data?
    By doubletiger in forum General Questions
    Replies: 4
    Last Post: 8 Oct 2006, 05:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR