Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Location
    Boise, ID
    Posts
    28
    Plugin Contributions
    0

    red flag merge 2 store databases

    We have two ZC sites currently setup and running, but would like to move over to just one but, in order to do so, we'd like to keep all of our customer information (address, order history, etc.) together.

    So, I'm writing in hopes that someone can enlighten me on how to merge the information from two databases into the one. I don't need to merge the store configuration or the product information, just the customer stuff and histories.

    I've searched the ZC site and documentation and cannot see where there has been discussed before.

    We're running version 1.5 for both sites.

    Thanks for any advice in advance!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: merge 2 store databases

    Mangling the data to do as you're asking is an intense exercise that should only be done by someone knowing quite a bit about databases and the Zen Cart database structure/schema and table relationships.

    Zen Cart v1.x treats order numbers and customer numbers based on the assumption that there's only one store in the database. As such, order numbers start at 1 and move up.

    So, you likely have two stores with an order number 1, and a number 2, etc.
    And your customers have order-confirmation emails containing messages like "Your order number is: 1 and to view it click here: www.__.com/???order=1"

    If you try to "merge" all the data from Store B into Store A, it will require finding out the last order number in Store A, then rebuild all the orders from Store B starting at that new order number, until all the orders are done. It will also completely break all the links in the old emails those customers have received and their order numbers won't match the text or printed invoices they've received. Then you'll need to do the same with all the customers and their addresses etc. (actually you'd need to do the customers+addresses first, before the orders).Fortunately the customer "number" is less important in terms of emailed history etc.

    Are you okay with that? Is your accountant okay with that? Are your customers okay with that?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Dec 2011
    Location
    Boise, ID
    Posts
    28
    Plugin Contributions
    0

    Default Re: merge 2 store databases

    Actually, yes we are okay with having the links in the emails sent to customers being a little incorrect. And I would be okay with getting someone to do the database merging, I would just like to know which tables within the database would need to be merged in order to do this. From your reply, it sounds like the ad customers and addresses would have to be done first (and separately) from the orders and their history.

    Is there an overview anywhere on this?

    Thanks!

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: merge 2 store databases

    You'd need to first re-number all the customers and their addresses, and then renumber the address records for the customers (there's a two-way relationship to maintain). And then you need to renumber all the customer ids in all the orders to use the new numbers. And then you need to renumber all the orders. And in all those cases there are multiple tables having multiple IDs that need maintaining all the way through. And then copy all those records over.

    I'm extremely reluctant to just "hand over a list of tables" because I'm scared that you'll just run off and break everything. To be honest, if someone is asking the questions you're asking, then you're definitely not the person who should be tackling this exercise. Nevertheless, the list of tables is here: http://www.zen-cart.com/wiki/index.p...atabase_Schema
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jul 2009
    Location
    Norwich, UK
    Posts
    120
    Plugin Contributions
    0

    Default Re: merge 2 store databases

    This is how I did mine.

    I had a rather large site, and wanted to build another site.

    The way I did it was I have one database, 2 sites, 1 site up and running, the other spare.

    I completed the other build and then added the two sites into one database.

    Simple if you know MYSQL for a living.

    But to explain it in a simple term, you need to re-build your less popular store from fresh and add the database you have into it.

    Simple, then add images ect. Job's a good'un!

    If you need more help, im sure I can help.

    But as for merging, well it's a rather complicated process.

    James
    FMUK Consulting - Web Design & Development | Graphics | Marketing | Apps - http://www.FMUKConsulting.co.uk

 

 

Similar Threads

  1. syncing databases
    By keneso in forum General Questions
    Replies: 4
    Last Post: 8 Jul 2015, 04:10 PM
  2. Number of Databases
    By Nectarina in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 4 Jan 2008, 10:17 PM
  3. Replies: 4
    Last Post: 16 Aug 2006, 06:19 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