Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2010
    Location
    County Down, Northern Ireland
    Posts
    302
    Plugin Contributions
    0

    Default 2 Carts/Shops sharing 1 Database

    I wish to have 2 separate ZenCarts/Sites which share the same database. I read somewhere that this was possible but cannot find the article.

    Do any of you know how to do this.

    Also if say one site had 100 products and the other say 80 out of that 100 it is possible to go in to the ZenCart Control Panel of the site where I want the 80 products and go in and turn off the other 20 and they will not appear in that site but will appear OK in the one that I want 100.

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: 2 Carts/Shops sharing 1 Database

    Yes, and, I think, no.

    You can have two Zencart sites share one database by specifying a DB table prefix for each when you install Zencart. I have no idea why you'd want nto do that though.

    Doing as I described above essentially creates two different databases in the same DB structure, so the two sites couldn't share products.

    https://www.zen-cart.com/tutorials/index.php?article=66

  3. #3
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: 2 Carts/Shops sharing 1 Database

    Yes it is possible. One code set, one database, two (or more) sites.

    Two possible approaches ...

    Firstly there's a multisite add-on somewhere in the downloads area that I believe works by separating products for each site into categories, which I guess you could then cross-link between (we've not actually used this mod at kuroi).

    Second approach (which we have used) is much more technical and requires a fairly high degree of techncial knowledge of Zen Cart's internals, though the changes themselves are fairly surgical. You'd need a new table (or an extension of the existing product table) to indicate which products were available to which site. Then the listings and search pages algorithms need tweaking to restrict the products displayed to those that are appropriate to the site - we re-wrote the misnamed "hidden wholesale" add-in module to allow this. Then there are admin changes to allow whatever data structure you've implemented to be maintained on the product pages (we actually customised the quick updates add-in to do this).

    We took it further too. So the tax treatment is different between the sites: the client has a wholesale site which shows prices ex tax and a retail site that shows them inclusively, which was done by hijacking the display with tax constants and setting them according to the site URL. We also recorded the where the purchase was made in order to brand invoices accordingly. And topped the whole thing off with a multi-domain SSL cert to avoid nasty warnings in browsers.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  4. #4
    Join Date
    Apr 2010
    Location
    County Down, Northern Ireland
    Posts
    302
    Plugin Contributions
    0

    Default Re: 2 Carts/Shops sharing 1 Database

    Thank you for your answers. Will study those in detail.

    As to the question WHY DO WE WANT TO DO THIS ? Simple to avoid having to upload 80 products, descriptions and images on one Database to have to repeat the same exercise on another 2nd database.

    For example we have 100 products which sell on one site but then we have a similar site but because of the country it is being targeted at we will be omitting around 20 of the pruducts that are on original site.

    Open to suggestions as to the best approach if what I am suggesting is not the best way.

    Apart from the duplicate uploading then at a later date if we have to change prices/images etc it would mean double work again if it is two separate ZenCarts/Shops.

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: 2 Carts/Shops sharing 1 Database

    I suspect that you'd find more work setting up and maintaining a multisite than maintaining 80 common products across two sites.

    But a lightweight alternative might be to use just the hidden wholesale mod to suppress the 20 based on an IP-lookup evaluation of the country from which the traffic is coming.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  6. #6
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: 2 Carts/Shops sharing 1 Database

    Quote Originally Posted by irishshopper View Post
    Thank you for your answers. Will study those in detail.

    As to the question WHY DO WE WANT TO DO THIS ? Simple to avoid having to upload 80 products, descriptions and images on one Database to have to repeat the same exercise on another 2nd database.

    For example we have 100 products which sell on one site but then we have a similar site but because of the country it is being targeted at we will be omitting around 20 of the pruducts that are on original site.

    Open to suggestions as to the best approach if what I am suggesting is not the best way.

    Apart from the duplicate uploading then at a later date if we have to change prices/images etc it would mean double work again if it is two separate ZenCarts/Shops.

    imo:
    With only 2 websites and around 100 products it will be far quicker to do it manually than to try to set up what you are asking.

    To ease initial setup copy the 100 product database to the new database and delete the 20 products from the new database that you don't need.

    You should probably spend far more time customising the appearance of the 2 websites than updating a 100/80 product database in 2 websites.

  7. #7
    Join Date
    Apr 2010
    Location
    County Down, Northern Ireland
    Posts
    302
    Plugin Contributions
    0

    Default Re: 2 Carts/Shops sharing 1 Database

    Thank you for your response. I think this would be the easiest approach and will go with it. Can change files and upload them but just not sure what exactly I need to do to copy the database and delete the products as below.

    To ease initial setup copy the 100 product database to the new database and delete the 20 products from the new database that you don't need.

    Where do I access the database to copy it ? Once I do manage to copy it do I just go in to the ZenCart Control Panel of the new site and turn off/delete the 20 products there ?

    I have a number of new sites to set up which would share the same basic core of products with then some regional variations added to the basic products so it would be great if I knew how to "copy the database over".

    THANK YOU.

  8. #8
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: 2 Carts/Shops sharing 1 Database


 

 

Similar Threads

  1. two shops, mixing database?
    By dimar in forum General Questions
    Replies: 4
    Last Post: 18 Sep 2008, 04:07 PM
  2. Error: two shops sharing the shopping cart
    By magicpants in forum Basic Configuration
    Replies: 7
    Last Post: 27 Jan 2007, 09:21 AM

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