Zen Cart Logo
Forums / Basic Configuration / Can I change what database ZenCart is using?

Can I change what database ZenCart is using?

Locked

Views: 5,540

Results 1 to 17 of 17
This thread is locked. New replies are disabled.
6 May 2009, 5:03 PM
#1
verve avatar

verve

New Zenner

Join Date:
Dec 2008
Location:
Cape Town! South Africa
Posts:
9
Plugin Contributions:
0

Can I change what database ZenCart is using?

Hi

Is it possible to change the database that ZenCart reads from? And if so, what do I need to do that?

Alternatively, is there any way to copy everything from one sql database to another one that has nothing in it?

Thanks in advance
:-)

6 May 2009, 5:38 PM
#2
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,845
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

Yes in the includes/configure.php and admin/includes/configure.php is a database section that looks like the following:```
// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', ''); // prefix for database table names -- preferred to be left empty
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'YOUR_DB_USERNAME');
define('DB_SERVER_PASSWORD', 'YOUR_DB_PASSWORD');
define('DB_DATABASE', 'YOUR_DB_NAME');


You can adjust this to look at the correct database.

You can use phpmyadmin, if your hosting control panel has access to it, to export the database and to import into the empty database.
16 Jul 2010, 6:51 PM
#3
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

hello! this might be a bit old.. but i didn't feel i need to create a new thread if I a question that relates to this change.

What do I do with the existing database before I switch it?

Right now it's using database A

My zencart is Database b.

Do I need to re-direct database A?

Some notes:

The author of Database A did not create a folder for the files. it's all in the root folder. Database A was made from scratch.

THANK YOU!

16 Jul 2010, 6:57 PM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Can I change what database ZenCart is using?

In principle you simply make the changes that barco57 describes. These don't affect the databases at all, just change the database that the site points too. But I suspect we don't have the whole story. Is your site live? If so, what are you going to do with any orders already recorded there? Has your new database been set up ready to accept the redirection?

16 Jul 2010, 7:03 PM
#5
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

my current site is live and it's just a showroom. it's configurations are completely different from zencart as it's written from scratch. it's very simple.

16 Jul 2010, 7:06 PM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Can I change what database ZenCart is using?

So Zen Cart has nothing to do with your existing database. I'm confused. Are you asking how your would transfer information from your existing site's database into Zen Cart?

16 Jul 2010, 7:12 PM
#7
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

im sorry i wasn't very clear. Right now, is the live site. I don't want that anymore. I would like the url https://www.greatintl.com to redirect to my zencart. I know that I would have to change the server in my configure.php files to reflect that. However, I don't know what to do with my current one. I don't want to delete it or anything. I want it to still be there so I can switch it back if problems arise.

My live site and zencart have their own separate info. I don't want anything carried over. Just a swtich so when https://www.greatintl.com is visited, they will see zencart vers.

Does that make sense?

16 Jul 2010, 7:20 PM
#8
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Can I change what database ZenCart is using?

Yes. Move all the files in your current site to a subdirectory (/old, for example) then move the Zencart folders and files to the root (top directory) and make the changes to the configure files noted above or here:

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

22 Jul 2010, 2:33 AM
#9
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

Hey Stevesh!

Thanks for your reply! So I took a look at your post and at the link you provided and from my understanding in reading this that it seems fairly simple:

Move the current website's files to a new folder
(I would like to keep zencart in it's current folder. So the root will have these 2 folders: one is the /old and the other is the zencart one)
Locate /includes/configure.php and /admin/includes/configure.php files and change settings to become writable.

Then change these settings to reflect the new location and URL:

DIR_WS_CATALOG

DIR_WS_HTTPS_CATALOG

DIR_FS_CATALOG

DIR_FS_SQL_CACHE

DIR_WS_ADMIN (in admin)

DIR_WS_HTTPS_ADMIN (in admin)

DIR_FS_ADMIN (in admin)

Then change it back to read-only

Correct?

22 Jul 2010, 3:17 AM
#10
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

So I've done more reading on this matter.. and from my understanding.... zencart files MUST be in the root folders, it cannot be placed in another folder?

root/
all zencart files

NOT

root/zencart/
all zencart files

Correct?

22 Jul 2010, 3:21 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I change what database ZenCart is using?

dimsumgurl:

So I've done more reading on this matter.. and from my understanding.... zencart files MUST be in the root folders, it cannot be placed in another folder?

root/
all zencart files

NOT

root/zencart/
all zencart files

Correct?
No, that's not correct.

Zen Cart can run from a subfolder just fine.

But if YOU want it such that visitors to your URL at www.your_site.com go directly to your Zen Cart store, then it's easiest to simply put your Zen Cart files into that "root" (actually more accurately "webroot") folder directly. ... ie: the "root/" all zen cart files, as you stated.

22 Jul 2010, 3:27 AM
#12
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

Ah ok thanks for your reply! I understand now!

I forgot to mention this in my previous post.

I looked through the configure.php file in admin and noticed this:

define('HTTP_SERVER
define('HTTPS_SERVER
define('HTTP_CATALOG_SERVER
define('HTTPS_CATALOG_SERVER

Wouldn't those also be needed to be changed to reflect the new URL of https://www.mysite.com/zencart to https://www.mysite.com/?

THANK YOU

22 Jul 2010, 3:38 AM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I change what database ZenCart is using?

no, because they should only contain your domain name anyway.
The subfolder that you had it in should have been in the DIR_WS_xxx and DIR_FS_xxxx settings.

22 Jul 2010, 6:26 AM
#14
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

alright.... so it seems that I may have encountered a problem while trying to implement this......

So currently, my site is

define('HTTP_SERVER', 'http://zencart.greatintl.com');
define('HTTPS_SERVER', 'https://zencart.greatintl.com');

I want to change it to

define('HTTP_SERVER', 'http://greatintl.com');
define('HTTPS_SERVER', 'https://greatintl.com');

BUT instead of

define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

To

define('DIR_WS_CATALOG', '/zencart/');
define('DIR_WS_HTTPS_CATALOG', '/zencart/');

So therefore https://www.greatintl.com/zencart/

I have searched the forums and followed the tutorials that are provided on this site. All the forum topics I found similar had basically the same solution as in to check and make sure to keep '/'.

Not really sure what Im doing wrong here... nothing is changed in regards to the location of the folders.

I am going to be straight here, I am quite new in this field. So please let me know that what I am doing here is unnecessary.

thank you!

22 Jul 2010, 3:43 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I change what database ZenCart is using?

You started out talking about "changing what database Zen Cart is using" by latching onto a previous discussion.
But now it appears that's not really what you're doing?

22 Jul 2010, 4:25 PM
#16
dimsumgurl avatar

dimsumgurl

Zen Follower

Join Date:
Dec 2009
Location:
Canada
Posts:
160
Plugin Contributions:
0

Re: Can I change what database ZenCart is using?

hmm that is true. I will either look for other similar threads or start my own.

22 Jul 2010, 4:27 PM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can I change what database ZenCart is using?

I suggest you start your own and in it state exactly what you're wanting to do and why, with specific details.