Jump to content

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 post
Share on other sites

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.

Link to post
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 post
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.

 

Edited by bsmither
Link to post
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.)

Edited by bsmither
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...