Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multiple Databases


rasterburn

Recommended Posts

hello, I am in the process of setting up an online store, currently utilizing my development server. I would like to utilize 2 databases for half of the site I have started out with installing 2 instances of OSCommerce v2.3.1 at the directories "/srv/" and "/home/michael/public_html/". The first instance of OSC is using DB1 while the second instance of OSC is using DB2.

 

The reason for the 2 instances of OSC is that instance 1 is the store while instance 2 is being used as a simple CMS for relevent product and topic information with links to their respective products in the store, I have been working on the pages for a couple days so far only to get the store related parts stripped from the second instance while keeping the admin functionality of updating.

 

I have noticed that if i change the db in the second instance of OSC to use the db for the first instance of OSC then user sessions are stretched across both instances (including the categories, I assume that user sessions and logins are stored in the database). What I would like to do is setup the second instance to use both databases, db1 for session data (account info and shopping cart) as well as the search box while utilizing db2 for the categories and the search box (yes thats right, i would like to utilize both databases during a search). Has anyone accomplished this already? If so could you tell me how to accomplish it myself? as i dont want to hardcode all the data for the categories and items of the second instance (could pose to be several hundred pages created with several hundred modifications to get the pages in). If no one has used multiple databases with OSC 2.3.1 yet can someone tell me how to span the session info across both instances while keeping the category data separate in their own respective database?

 

keep in mind while replying that access to instance 1 is "http://[ip addy]"(/srv/) while access to instance 2 is "http://[ip addy]/~michael/"(/home/michael/public_html/)

 

I might be able to explain it differently if it is too difficult to understand but for now it makes perfect sense in my mind.

Link to comment
Share on other sites

Michael,

 

I have heard of people sharing 1 database between 2 or more stores, but never 1 store sharing 2 databases. As you have found, sessions are store in the database. I don't know how you would get around that as they are an integral part of the cart process.

 

 

I guess the question most on my mind......is WHY ?

 

Why would you want to split the databases into two for one store ?

 

 

 

Chris

Link to comment
Share on other sites

ok so the reason for splitting to use 2 databases is kinda part of the design of the grand scheme of things, I feel when building sites and stores, the user shouldn't have to go to other sites to gather information about what they will buy, so simply site1 uses db1 site2 uses db2 that keeps the categories separate from each other I then want to integrate and blend things so that site2 will query db1 for user information.

 

in the end its supposed to look something like:

 

www.domain.com -> site1 -> db1

wisdom.domain.com -> site2 -> db1, db2

 

so for db1 on site 2, i want to use it for session and user data including the shopping cart, is there any simpler way to drag the session uid across from site1 to site2 without scraping db2? not sure if i can utilize cookies with OSC, im not that overly fluent in php or java, just fluent enough to break the system and repair it and modify minor parts

Link to comment
Share on other sites

ok so from the number of replies compared to the number of view i would assume that nobody knows how to accomplish this task. I suppose I can attempt to try another direction, same idea but different... does anyone know how to set the primary OSC install to write the session data not only to DB1 but also to DB2 at the same time? Thus allowing the session data to be transfered from install 1 to install 2

Link to comment
Share on other sites

Transferring session data from 1 site to another is possible and doable. But keep in mind that it will require a lot of work. I can't recall exactly where I talked to this one person who had partially accomplished it where they had one checkout for multiple stores by getting the session data and processing orders. But then again their company had invested a lot of money into it.

Link to comment
Share on other sites

Instead of using two databases, use a single database and change the database table names in the second copy of osCommerce. Since you want the sessions to carry across, don't rename the second session table. You will need to update the database_tables.php in catalog and admin to match the new table names. I have done this (running two different versions of osCommerce on a single database) and it works.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

if i need to update the file database_tables.php and add change the table names in sql then would i not have to update virtually every php page OSC to reflect the changes of database_tables.php and the sql database adjustments?

Link to comment
Share on other sites

No, the database table names are all defined in database_tables.php and the rest of the files use those definitions.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

No, it was two sites on two different domain names (one of them a subdomain) and the files were in two different root directories. The only thing that they had in common was the database. There weren't even any database tables in common, although there could have been.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...