Jump to content

how to add prefix to the database after installation


Guest dkmobile

Recommended Posts

Guest dkmobile

Hi there,

i try to add a prefix to the database so that i can share it with other domain.

i know i can add a prefix to it during the installation of the cubecart, but i don't know how to do it if i didn't put the prefix during installation, but i want to put it now.

can someone tell me how to do it?

thanks in advance

Steve

Link to comment
Share on other sites

Guest dpage44

Hi there,

i try to add a prefix to the database so that i can share it with other domain.

i know i can add a prefix to it during the installation of the cubecart, but i don't know how to do it if i didn't put the prefix during installation, but i want to put it now.

can someone tell me how to do it?

thanks in advance

Steve

Backup then edit the includes/global.inc.php file

Here is the file from my local test box. Just put your dbprefix between the single quotes. (where rufus is). Your file will have nothing between the single quotes

<?php

$glob['dbdatabase'] = 'cubecart';

$glob['dbhost'] = 'localhost';

$glob['dbpassword'] = 'ou812';

$glob['dbprefix'] = 'rufus';

$glob['dbusername'] = 'root';

$glob['installed'] = '1';

$glob['rootDir'] = 'C:\\htdocs\\cubecart';

$glob['rootRel'] = '/cubecart/';

$glob['storeURL'] = 'http://localhost/cubecart';

?>

Link to comment
Share on other sites

Guest dkmobile

Just changing the prefix there won't change your existing database. You'll need to add the prefix to every table name also.

;)

thanks for the information, i try and u r right, changing the prefix won't change the existing database.

i got a more serious problem now.

i install the 2nd domain and during installation i put exactly same database information as the 1st domain, including the prefix, databasename, useer information, cubecartname, etc....

problem start after installation, i cannot access the 1st domain any more, when i browse the 1st domain it have an error page. when i go to the PHPadmin and look at the tables of the inventory, ........ all my data that i put in (which is my products) was gone!!!! instead it only have 1 test product which is the one that i install the 2nd domain..... this is a lightmare to me.............and worse thing is i just realize that i didn't have the table export before, i only have a back up to the cubecart files but not the database which i don't know until i see the import export button from the PHPadmin today.

can u help to show me how can i fix this problem, or i have to start over again from the begining to put everything on????

thanks

Steve

Link to comment
Share on other sites

Guest dpage44

I mis-read the original post. Thought the original database had a prefix and the 2nd store was installed without. My bad. ;) The second store's includes/global.inc.php file could have been edited to hook up to the original database.

I have used the procedure I mentioned. I have taken my live store db backup and imported it to a local install where I forgot to put in the prefix.

Steve, if you got no db backup, you are at the beginning. :on2long:

Link to comment
Share on other sites

Guest dpage44

Just to satisfy my curiosity, I tried hooking up 2 store to 1 database on my local machine.

1) I backed up my live store and db to my local machine.

2) Created 2 db with phpMyAdmin (test1, test2)

3) Created 2 directories (test1,test2)

4) Installed CC in each directory hooking up each to its corresponding database.

5) Imported the live store db, replacing test1 db.

6) Copied the images/uploads files and my current skin folder from the backup to both test directories

7) Modified the includes/global.inc.php file in test1 to match the database prefix and the local test environment. Verified that the store worked. Copied the test1/includes/global.inc.php file to test2 and verify the store worked.

I was able to view and add products while in both stores. I didn't do a full test of all operations. For grins I copied all my back up files to each directory (after saving the working includes/global.inc.php files, then restoring them). That's where I had troubles with the SEO mod working in the first directory and causing a fatal error in the second. I'm sure there are more "land mines" out there for a 2 store /1 db setup that my brief experiment didn't show.

For 2 completely different stores/ 1 db, you would have to work out shipping issues, and site documents issues, skin issues, mod issues ;) whew!!

My 2 cents: Do 2 separate installs each with its own db. Then google "Bulk Import Module" Buy 2 licenses to synch products to each store from a pre-populated text file (your master inventory sheet). Do I hear a :on2long: ?

Link to comment
Share on other sites

Guest dkmobile

Dear Dpage44,

you r so nice to tell me all that, it will be very useful for me...................in the future.......................because i bust my db already............... :-( .......

i need to rebuild it...............i just back up all the files for the cubecart, but i never backup those takes from the Phpadmin..................

thank you very much for all the imformation, it will help for me to re-build the enter store (although it is painful..... i put around 800 items to my store..........and now need to re-do it.....

hope me good luck

steve

Just to satisfy my curiosity, I tried hooking up 2 store to 1 database on my local machine.

1) I backed up my live store and db to my local machine.

2) Created 2 db with phpMyAdmin (test1, test2)

3) Created 2 directories (test1,test2)

4) Installed CC in each directory hooking up each to its corresponding database.

5) Imported the live store db, replacing test1 db.

6) Copied the images/uploads files and my current skin folder from the backup to both test directories

7) Modified the includes/global.inc.php file in test1 to match the database prefix and the local test environment. Verified that the store worked. Copied the test1/includes/global.inc.php file to test2 and verify the store worked.

I was able to view and add products while in both stores. I didn't do a full test of all operations. For grins I copied all my back up files to each directory (after saving the working includes/global.inc.php files, then restoring them). That's where I had troubles with the SEO mod working in the first directory and causing a fatal error in the second. I'm sure there are more "land mines" out there for a 2 store /1 db setup that my brief experiment didn't show.

For 2 completely different stores/ 1 db, you would have to work out shipping issues, and site documents issues, skin issues, mod issues ;) whew!!

My 2 cents: Do 2 separate installs each with its own db. Then google "Bulk Import Module" Buy 2 licenses to synch products to each store from a pre-populated text file (your master inventory sheet). Do I hear a :on2long: ?

Link to comment
Share on other sites

Guest flyerguy

Here's one along these lines that I hope someone can help with.

I have an existing store and database.

I want to share the database with a new store. (2 stores, same items).

When I setup the second store and point it to the database, it finds all the products with no problems. It also finds the layout of the first store such as skin, metatag info, and all other information for the first store as this appears to be stored in the database.

While I want to share the products in the store, I want 2 completely different looking stores, different skins, different logos, etc.

Also, when setting up my database, a prefix is assigned automatically in the form of "username__" so if I am to assign prefixes, how would I do this as it appears that the prefix is automatically assigned?

Thanks in advance for any help offered from a newbie!

Link to comment
Share on other sites

mythbuster => */*

Using a db prefix to differentiate the two stores WILL NOT accomplish what you want, flyerguy. Here's how that works.

If you have a hosting account that allows only one MySQL database, you can run more than one spearate stores with the one MySQL database by using a different prefix for one of the stores. This will create a whole separate CubeCart installation, so there will be two sets of CC tables in the one db. One set without a prefix, the other with a prefix. This is the same, in effect, as having two stores on totally separate databases. If your hosting account allows you to have more than one db, you may as well just have separate dbs on these two stores. It is the same effect.

NOW. As to having two stores on one database, sharing the same exact tables . . . :D

Of course this can be done. I do it quite regularly, in fact, when upgrading stores for folk I will often have a brief period when mystore.com and mystore.com/newStore will share the live db ~ but in those cases, I don't leave them both on there for very long. This is the scenario that flyerguy refers to. As to having a completely different look to these stores, that can be accomplished very easily by having a skin at store A and a totally different skin at store B both with the exact same name :w00t:

From there it gets much more difficult, though. Running two separate stores from the one db will run into other problems, and will require some modding to make it work. Everything you set on the store's General Settings page goes into an array saved to db - so the stores will have the same store names, along with all other settings. They will have the same admin accounts, etc. etc. etc. So basically, there is no easy answer or solution for this. If you have to ask, you probably can't do it for yourself.

There may be other solutions you could explore for what you want to accomplish, other than using two stores from same data.

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