Jump to content

Two Stores, One Admin


Cpup

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...