Cpup Posted November 12, 2020 Posted November 12, 2020 Hi, I have two cubecart sites, but want to be able to control both from one admin control panel. Would this be possible? The reason being is, I want to sell gift cards, but allow the customer to be able to spend them in either shop. If can only have one admin per site, is there a way to use multi-site gift cards? Thanks
Al Brookbanks Posted November 12, 2020 Posted November 12, 2020 CubeCart doesn't have this ability I'm afraid.
bsmither Posted November 12, 2020 Posted November 12, 2020 These two sites... Would they be using the same database, but using unique table prefixes? Like "store1_CubeCart_inventory" versus "store2_CubeCart_inventory"?
Cpup Posted November 12, 2020 Author Posted November 12, 2020 One database is tech_CubeCart and the other is pets_CubeCart. I was hoping to be able to use different sites for different products, but at least be able to use gift cards between both.
fabriceunko Posted November 12, 2020 Posted November 12, 2020 Question can be beta but if the gift card with the same code in the two store could not work?
bsmither Posted November 12, 2020 Posted November 12, 2020 Using the same database host -- good. That means that by using a hook, if the GC code entered at checkout cannot be found in "pets", then look for it in "tech". If the GC is found and verified, then manage the GC with that table prefix. Be back later.
Cpup Posted November 12, 2020 Author Posted November 12, 2020 I like the sound of where this is going Can a DB be called up between different tables of different stores from checkout?
bsmither Posted November 12, 2020 Posted November 12, 2020 In /includes/global.inc.php, there is the details of how to log in to the database used by that particular installation of CubeCart. Within a database host (localhost, for example), there can be any number of database schemas. A schema is a fenced-in collection of tables and is given a unique name (a database name). Within the schema, CubeCart maintains a 'dbprefix'. During setup, the store owner can designate a prefix to make multiple installs uniquely identifiable. It is possible to give a database user very granular permissions on a few specific tables even if there are thousands of tables in the schema. But that requires complicated efforts to set that up. With respect to having PHP see different schemas, and even see different hosts -- certainly. Give the proper access credentials and you're in.
Cpup Posted November 12, 2020 Author Posted November 12, 2020 Nice one, thanks! I shall have a look at that. Nice work Can you add both databases into /includes/global.inc.php?
bsmither Posted November 12, 2020 Posted November 12, 2020 That would be a convenient place to keep info for both databases. ## Tech database $glob['dbdatabase'] = 'Cpup_tech'; $glob['dbhost'] = 'localhost'; $glob['dbusername'] = 'username'; $glob['dbpassword'] = 'password'; $glob['dbprefix'] = ''; ## Pets database $glob['dbdatabase_pets'] = 'Cpup_pets'; $glob['dbhost_pets'] = 'localhost'; $glob['dbusername_pets'] = 'username'; $glob['dbpassword_pets'] = 'password'; $glob['dbprefix_pets'] = ''; Then, in the controller file: $GLOBALS['db_pets'] = Database::getInstance($glob, '_pets'); And a bit of work in the Database class (due to the fact that it is created as a Singleton). (Note that, even if you have permission to access the Pets database from the Pets store, if the Tech store is located outside the environment, there may be firewalls and database server access lists to contend with.)
Cpup Posted November 12, 2020 Author Posted November 12, 2020 Thanks Brian, I'll check it out tomorrow.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.