Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

3 stores 1 Database


day2

Recommended Posts

Hi,

 

I am in the midst of the project to have 3 stores selling diff line of product yet i want the customer only need to keep 1 profile with us. Installing 3 store in 3 diff folder under 1 domain is easy. Modified the configure files to refer to 1 database is easy.

 

I created the 3 product parent ID to split the 3 product line

 

My challenge is of course to avoid the 3 diff line of products appears in wrong stores, hence i need to do a lot of customization in the respective php files, such as advanced_search_result.php, shop_by_price.php and the info boxes.

 

I know no body will ready border if i keep on posting question on how to customise this and that one by one.

 

Can somebody provide me with some general guide? i realised a lot of queries was direct from product table where cat_ID wasn't form part of it, but it were than filtered via some code p2c, p pd etc which, i am not really understand what is it.

 

I need some basic idea for me to get it done, some resource or explaination.

 

Your help is very much appreciated.

 

Thanks. :lol:

Link to comment
Share on other sites

Can somebody provide me with some general guide? i realised a lot of queries was direct from product table where cat_ID wasn't form part of it, but it were than filtered via some code p2c, p pd etc which, i am not really understand what is it.

 

those abbreviates are 'alias names' of the tables. if you notice, later on in your select statement you have something in your from clause like 'products_descriptions as pd' or 'products_to_categories as p2c' these are defining the 'pd.' as a prefix to differentiate a column name coming from the products_descriptions table.

 

the alias names only last as long as the select. so in the very next select you can use a different name, or the same name to refer to a different table. that's a bad design, but some people do it. if you're consistent in the naming (and i think osc is pretty good about it) then it saves you some confusion later on.

 

get yourself a book on mysql. things like this can be looked up quickly if you have the resources at hand. it's often much faster than waiting for someone to reply to your questions here. :)

 

good luck.

Link to comment
Share on other sites

Unfortunately both multi stores solution can't work for me ><

 

http://addons.oscommerce.com/info/1730

 

This contribution seem like doesn't support the Osc latest Rca version; for instant the sql files request to create an administrator table but it already exist in the new version Osc, etc, and

 

http://addons.oscommerce.com/info/5510

 

This contribution allowed separate databases but the advantage is customer only need to create account once, sound interesting but it only contain a single text files which at first i doubt it will work and it is proven not working.

 

It try to refer all the customers to another independent database by the name of users, and change the database.php from

 

define('TABLE_CUSTOMERS', 'customers');

 

and replace with

 

define('TABLE_CUSTOMERS', 'users.customers');

 

Which doesn't work as database referred are always as setup in configure.php.

 

Dead.

 

><

Link to comment
Share on other sites

Hey,

 

I am continuing my experiment and has finding!! I got a new idea which is pretty easy, i created new table that need to involved in the store differentian, for instant, i created additional table of Product, named it Producta, manufacturer add a manufacturera etc, then referred the 2 stores to one database in configure files, and in the respective database.php, 1 store refer the "TABLE_PRODUCT" to "Product" whereas another store refer the same table to "Producta". And so on...

 

I make a few tests on it and it seem to be working, let me perform additional tests on all the action to ensure 100% functioning first, if it is proven working, this is going to be the first contribution that i am going to upload to OSC Add-On.

 

B)

Link to comment
Share on other sites

  • 1 month later...
Unfortunately both multi stores solution can't work for me ><

 

http://addons.oscommerce.com/info/1730

 

This contribution seem like doesn't support the Osc latest Rca version; for instant the sql files request to create an administrator table but it already exist in the new version Osc, etc, and

 

http://addons.oscommerce.com/info/5510

 

This contribution allowed separate databases but the advantage is customer only need to create account once, sound interesting but it only contain a single text files which at first i doubt it will work and it is proven not working.

 

It try to refer all the customers to another independent database by the name of users, and change the database.php from

 

define('TABLE_CUSTOMERS', 'customers');

 

and replace with

 

define('TABLE_CUSTOMERS', 'users.customers');

 

Which doesn't work as database referred are always as setup in configure.php.

 

Dead.

 

><

 

I was wondering if you figure out how to do what you needed. I'm basically looking for the same thing and I had no look with Multi-stores because it doesn't work with v2.2 rc2a.

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

all you need to do is install the multi-store and optimize it for the new version.. dont re-make it entirely

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

all you need to do is install the multi-store and optimize it for the new version.. dont re-make it entirely

I tried to install multi store in my site without any luck.... It looks like multi stores was written to work with v2.2 which has register_globals set to ON. How can i get multi-stores working on v2.2 rc2a? I'm able to see my store but I can't login into the admin. It looks like after entering the user/pasw. I doesn't redirect me to the right page.

 

//rmh M-S_multi-stores

require( DIR_WS_INCLUDES . 'functions/administrators.php' );

RequireLoginValidForPage( $REQUEST_URL );

 

 

I will appreciate any help or ideas you can provide.

ThanKsssssssss!

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

google REGISTER GLOBALS PATCH..

 

like i said, just because it isnt working now, doesnt mean it WONT work.. people can help you tweek.. Go to the support thread for it.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

google REGISTER GLOBALS PATCH..

 

like i said, just because it isnt working now, doesnt mean it WONT work.. people can help you tweek.. Go to the support thread for it.

 

Thank you for your fast response! I found the register_globals_v1.5 contribution (http://www.oscommerce.com/community/contributions,2097).

I'll give it a try.

Thank you much

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

well Mulitstore contrib was for osc2.2 prior to rc2.

 

with RC2 admin login has also come in the RC2 code so You need to chnage the code so that both admin logins gel together.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

well Mulitstore contrib was for osc2.2 prior to rc2.

 

with RC2 admin login has also come in the RC2 code so You need to chnage the code so that both admin logins gel together.

 

Satish

 

It doesn't seem too easy since multistores is all over the place in many files. I finally was able to login to my admin panel but now i'm getting this error all over the place.

 

Warning: implode() [function.implode]: Invalid arguments passed in /home/camiloho/public_html/la-connect/store/admin/includes/functions/general.php on line 1533
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') order by stores_name' at line 1

select stores_id, stores_name, stores_config_table from stores where stores_id in() order by stores_name

I still haven't heard of anybody integrating multistores with v2.2 rc2a. I also tried to find oscommerce v2.2 but I can't find it anywhere to compare codes. It seems that the problem is the SQL syntax which should be php 5.+ but I'm not a MySQL expert.

I appreciate your response and any ideas. THANK YOU

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

well You just need to take care of admin ogin thru code.

rest will not be affected much.

 

i did convert an stroe on rc2 in multistore but havent created a contrib.

 

am planning to come up with one.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

does this query looks ok for php 5? this is where the error above is taking me.

  function tep_get_stores() {
global $admin_allowed_stores;

$stores_query = tep_db_query("select stores_id, stores_name, stores_config_table from " . TABLE_STORES . ($admin_allowed_stores[0] == '*' ? " " : " where stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by stores_name");
while ($stores = tep_db_fetch_array($stores_query)) {
  $stores_array[] = array('id' => $stores['stores_id'],
						  'text' => $stores['stores_name']);
}

return $stores_array;
 }

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

i don't think your $admin_allowed_stores variable is set to anything. the sql statement shown above looks like this:

select stores_id, stores_name, stores_config_table from stores where stores_id in() order by stores_name

 

there's nothing inside the in() clause...and that's causing the problem.

Link to comment
Share on other sites

i don't think your $admin_allowed_stores variable is set to anything...

 

It's because I'm having a lot of trouble to install multi stores in osc v2.2 rc2 and I haven't been able to log into admin to add the fist store. May be this is the problem.

I'm trying right now in a separate folder to do a fresh install of v2.2 rc2 with the latest multi stores contribution. the first error tell me that I have to set register_globals to "on", so now I'm trying to add the register_globals_v1.5 patch files, but I'm still not able to login. Now the browser gives me this error:

 

The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

 

* Have you disabled or blocked cookies required by this site?

* NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.

 

Please advise. I'm not an expert but I could figure it out with some help.

Thank you. :D

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

Please advise. I'm not an expert but I could figure it out with some help.

Thank you. :D

 

i'm not familiar with that contribution, but if it's looking for something in the database, i'd suggest putting something in there. use phpmyadmin to populate the table with some information if you can't get into the admin portion. at least that way the code has something to work with, instead of failing like it is now.

 

unfortunately, i don't know what to put in the database. you might be better off looking for the forum that addresses this contribution and post a question there. you'll probably find better and faster results that way.

Link to comment
Share on other sites

just place an vardump $admin_allowed_stores and an exit to know what all stores are allowed or is it blank.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

I've been trying for quite some time now to install multi-stores in osc v2.2 rc2a. Now it seems that it got it to work (somehow).

First of all you need to fallow the steps that Jugeti suggested:

1º Install osCommerce v2.2 RC2a

2º Once installed the store, go to the created database and to suppress the table "administrators"

3º Once suppressed the table administrators, make the installation of Multi-stores v2.0, following the instructions included in the package

 

I have made this way the installation and it works well and at the moment I have not detected any problem.

 

Jugeti

 

Onece your done installing multi-stores you'll get the following error:
Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in
your php.ini configuration file or in the .htaccess file in your catalog directory.

to fix this I added the code from Magic SEO URL for osCommerce (Running osCommerce with Register Globals Off) .

 

MOD Title: osCommerce 2.2ms2-060817 Register Globals Off Workaround for PHP4 and PHP5
MOD Author: Jiri Stavinoha
MOD Description: Allow to run osCommerce 2.2ms2 on web servers with Register Globals Off or On (PHP4 and PHP5 compatible)

INSTALLATION INSTRUCTIONS

OPEN:

catalog/includes/application_top.php

FIND:

// start the timer for the page parse time log
 define('PAGE_PARSE_START_TIME', microtime()); 

BEFORE, ADD:

// Register Globals MOD - http://www.magic-seo-url.com

 if (version_compare(phpversion(), "4.1.0", "<") === true) {
$_GET &= $HTTP_GET_VARS;
$_POST &= $HTTP_POST_VARS;
$_SERVER &= $HTTP_SERVER_VARS;
$_FILES &= $HTTP_POST_FILES;
$_ENV &= $HTTP_ENV_VARS;
if (isset($HTTP_COOKIE_VARS)) $_COOKIE &= $HTTP_COOKIE_VARS;
 }

 if (!ini_get("register_globals")) {
extract($_GET, EXTR_SKIP);
extract($_POST, EXTR_SKIP);
extract($_COOKIE, EXTR_SKIP);
 } 

FIND:

// check if register_globals is enabled.
// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
ini_get('register_globals') or exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.');
 } 

REPLACE WITH:

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 /*if (function_exists('ini_get')) { // Register Globals MOD - http://www.magic-seo-url.com
ini_get('register_globals') or exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.');
 }*/ 

FIND:

// set SID once, even if empty
 $SID = (defined('SID') ? SID : ''); 

BEFORE, ADD:

// Register Globals MOD - http://www.magic-seo-url.com
 if (!ini_get("register_globals")) {
if (version_compare(phpversion(), "4.1.0", "<") === true) {
  if (isset($HTTP_SESSION_VARS)) $_SESSION &= $HTTP_SESSION_VARS;
}
if(!empty($_SESSION)) extract($_SESSION, EXTR_SKIP);
 } 

OPEN:

catalog/includes/functions/sessions.php

FIND:

 function tep_session_register($variable) {
global $session_started;

if ($session_started == true) {
  return session_register($variable);
} else {
  return false;
}
 }

 function tep_session_is_registered($variable) {
return session_is_registered($variable);
 }

 function tep_session_unregister($variable) {
return session_unregister($variable);
 } 

REPLACE WITH:

// Register Globals MOD - http://www.magic-seo-url.com
 function tep_session_register($variable) {
global $session_started;
if ($session_started == true) {
  $_SESSION[$variable] = null;
  return true;
} else {
  return false;
}
 }

 function tep_session_is_registered($variable) {
if(isset($_SESSION[$variable])) {
  return true;
} else {
  return false;
}
 }

 function tep_session_unregister($variable) {
unset($_SESSION[$variable]);
 } 

FIND:

 function tep_session_close() {
if (PHP_VERSION >= '4.0.4') {
  return session_write_close();
} elseif (function_exists('session_close')) {
  return session_close();
}
 } 

REPLACE WITH:

// Register Globals MOD - http://www.magic-seo-url.com
 function tep_session_close() {
foreach($_SESSION as $key => $value) {
  global $$key;
  $_SESSION[$key] = $$key;
}
 } 

OPEN:

catalog/admin/includes/application_top.php

FIND:

// Start the clock for the page parse time log
 define('PAGE_PARSE_START_TIME', microtime()); 

BEFORE, ADD:

 // Register Globals MOD - http://www.magic-seo-url.com
 if (version_compare(phpversion(), "4.1.0", "<") === true) {
$_GET &= $HTTP_GET_VARS;
$_POST &= $HTTP_POST_VARS;
$_SERVER &= $HTTP_SERVER_VARS;
$_FILES &= $HTTP_POST_FILES;
$_ENV &= $HTTP_ENV_VARS;
if (isset($HTTP_COOKIE_VARS)) $_COOKIE &= $HTTP_COOKIE_VARS;
 }

 if (!ini_get("register_globals")) {
extract($_GET, EXTR_SKIP);
extract($_POST, EXTR_SKIP);
extract($_COOKIE, EXTR_SKIP);
 } 

FIND:

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
ini_get('register_globals') or exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.');
 } 

REPLACE WITH:

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 /*if (function_exists('ini_get')) { // Register Globals MOD - http://www.magic-seo-url.com
ini_get('register_globals') or exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.');
 }*/ 

FIND:

// lets start our session
 tep_session_start(); 

AFTER, ADD:

// Register Globals MOD - http://www.magic-seo-url.com
 if (!ini_get("register_globals")) {
if (version_compare(phpversion(), "4.1.0", "<") === true) {
  if (isset($HTTP_SESSION_VARS)) $_SESSION &= $HTTP_SESSION_VARS;
}
if(!empty($_SESSION)) extract($_SESSION, EXTR_SKIP);
 } 

OPEN:

catalog/admin/includes/functions/sessions.php

FIND:

 function tep_session_register($variable) {
return session_register($variable);
 }

 function tep_session_is_registered($variable) {
return session_is_registered($variable);
 }

 function tep_session_unregister($variable) {
return session_unregister($variable);
 } 

REPLACE WITH:

// Register Globals MOD - http://www.magic-seo-url.com
 function tep_session_register($variable) {
$_SESSION[$variable] = null;
 }

 function tep_session_is_registered($variable) {
if(isset($_SESSION[$variable])) {
  return true;
} else {
  return false;
}
 }

 function tep_session_unregister($variable) {
unset($_SESSION[$variable]);
 } 

FIND:

 function tep_session_close() {
if (function_exists('session_close')) {
  return session_close();
}
 } 

REPLACE WITH:

// Register Globals MOD - http://www.magic-seo-url.com
 function tep_session_close() {
foreach($_SESSION as $key => $value) {
  global $$key;
  $_SESSION[$key] = $$key;
}
 } 

OPEN:

catalog/install/includes/application.php

FIND:

// Set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE); 

AFTER, ADD:

 // Register Globals MOD - http://www.magic-seo-url.com
 if (version_compare(phpversion(), "4.1.0", "<") === true) {
$_GET &= $HTTP_GET_VARS;
$_POST &= $HTTP_POST_VARS;
$_SERVER &= $HTTP_SERVER_VARS;
$_FILES &= $HTTP_POST_FILES;
$_ENV &= $HTTP_ENV_VARS;
if (isset($HTTP_COOKIE_VARS)) $_COOKIE &= $HTTP_COOKIE_VARS;
 }

 if (!ini_get("register_globals")) {
extract($_GET, EXTR_SKIP);
extract($_POST, EXTR_SKIP);
extract($_COOKIE, EXTR_SKIP);
 } 

FIND:

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 } 

REPLACE WITH:

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 /*if (function_exists('ini_get')) {
ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 }*/ 

SAVE/CLOSE ALL FILES

Apparenly everthing is running ok.

I hope this helps. :D

Civil engineer, not a programmer, but very curious.

Link to comment
Share on other sites

My problem with the Multistore contrib is that it does not allow sharing of the cart. I have a site with 2+ subdirs on the same domain, dedicated to a different set of products for accessibility and management reasons. The stores should be separate but share the customer DB and of course the cart for combined shipping.

 

I was thinking of just giving the other store its own product, category etc tables, but that sounds too easy to work. Is there a solution to share products and carts but use same DB?

 

d.

Link to comment
Share on other sites

My problem with the Multistore contrib is that it does not allow sharing of the cart. I have a site with 2+ subdirs on the same domain, dedicated to a different set of products for accessibility and management reasons. The stores should be separate but share the customer DB and of course the cart for combined shipping.

 

I was thinking of just giving the other store its own product, category etc tables, but that sounds too easy to work. Is there a solution to share products and carts but use same DB?

 

d.

 

I Believe is the session issue, if we can get the 2 & 3 stores share a session id it should work, unfortunately, i donno how.. :blush:

Link to comment
Share on other sites

Products can be shared.

but sharing cart is not possible nor recommended as where will the client pay for the products coming from 2 stores.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Is the following possible ?

 

STORE ONE: Already up and running with lot's and lot's of mods. (600) Products.

 

I would like to create

STORE TWO - different server different ip address --> grabbing appr. 200 products from STORE ONE

 

STORE THREE - different server - different ip address --> grabbing appr. 100 products from STORE ONE

 

I assume that contributions such as Header Tags Controller in STORE ONE carry over to STORE TRWO and STORE THREE

 

What about articles manager and added pages contributions ?

 

Can someone point me in the correct direction ?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...