Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi-Stores Multiple Shops Support


hobbzilla

Recommended Posts

This code that you cited seems like a nice contribution to move the setting from the sessions.php to the database but that's all it does. One could more easily go to the sessions files and edit it directly as follows:

 

  if (STORE_SESSIONS == 'mysql') {

    if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {

      $SESS_LIFE = 86400; // was 1440 (24 minutes)

    }

 

And this works in my other stores. But for some reason it does not work in this multi store site. I suspect that there is some unique code somewhere in this contribution that overrides that command line in sessions.php Perhaps something not unlike the code you cited. I suspect Hobbs knows what it is and put it there on purpose. I'm just waiting for him to pop in and hopefully clue us in. On the other hand I have searched high and low in the code and the database and can't find it so I shouldn't be surprized if he didn't put it there and doesn't know.

 

Maybe there's a clue in that code itself. what is that second if all about?

 

just a thought and you probably already did this, but its important to change the configure.php file too:

 

You must have STORE_SESSIONS in the 
catalog/admin/includes/configure.php
Set as follows:
define('STORE_SESSIONS', 'mysql');

 

i think in a default osc installation STORE_SESSIONS is ' ' blank....

 

later....

Link to comment
Share on other sites

just a thought and you probably already did this, but its important to change the configure.php file too:

 

You must have STORE_SESSIONS in the 
catalog/admin/includes/configure.php
Set as follows:
define('STORE_SESSIONS', 'mysql');

 

i think in  a default osc installation STORE_SESSIONS is ' ' blank....

 

later....

Hey Tahuti,

Thank you for trying to help with this.

Yes I do have that set in config like that.

 

It just dawned on me that somehow it must be working for you; that your sessions are not too short. So I wonder:

 

1. What version of Multi-Stores do you have installed?

2. Do you get the default stock oscommerce admin screen or the special multistore one?

3. Were your sessions long enough out of the box or did you have to do something to make it work, i.e. did you use that code from Creloaded to make the sessions longer?

 

Note: I just set-up a new store, basic stock version plus one little mod and the admin is up forever because my php.ini is set to about 4 hours but still my multi-store site kicks me out in what seems to be less than 24 minutes.

 

Hopefully this will give us a clue.

 

Edward

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

Hey Tahuti,

Thank you for trying to help with this.

Yes I do have that set in config like that.

 

It just dawned on me that somehow it must be working for you; that your sessions are not too short. So I wonder:

 

1. What version of Multi-Stores do you have installed?

2. Do you get the default stock oscommerce admin screen or the special multistore one?

3. Were your sessions long enough out of the box or did you have to do something to make it work, i.e. did you use that code from Creloaded to make the sessions longer?

 

Note: I just set-up a new store, basic stock version plus one little mod and the admin is up forever because my php.ini is set to about 4 hours but still my multi-store site kicks me out in what seems to be less than 24 minutes.

 

Hopefully this will give us a clue.

 

Edward

 

oh sorry mine has never worked for more than about 20 minutes but i just assumed that was due to my php.ini file settings which i dont have access to as a shared server customer.....

 

i was just passing along the information i had.....

 

later...

Link to comment
Share on other sites

That is awesome. Great job Ryan!

 

This is the a really important tool for this type of system. When do you think you will have a moment to upload it?

 

Will it be in the Easy Populate or the Multi Store section in the contributions?

 

Thanks,

Brad

It has been uploaded at the Easy Populate section

 

http://www.oscommerce.com/community/contributions,500

Link to comment
Share on other sites

I just noticed that the newsletter module doesn't appear to have anyway of distinquishing one store from another and thus any emails would go to everyone in both stores. So then what would you say in your email. Please visit this.com and that.com or theother.com? If we can configure different stores with different presentations of different products then it would go to reason we would also want to send different emails to customers of different stores. Am I missing something?

 

I am curious to know how others are using mult-store and whether this is important or not to you.

 

Edward

 

To be honest, the newsletter module is _very_ basic. I don't use it for e-mailing customers.. therefore it has never been a priority to get "multi-store-ified".

 

With a little effort, and using the stores_id from customers_info table you should be able to seperate customers based on referring store.. however right now customers are not on a per store basis.. so perhaps then the best way would be to send the e-mail out based on the store that is "active" in the admin.

Link to comment
Share on other sites

This code that you cited seems like a nice contribution to move the setting from the sessions.php to the database but that's all it does. One could more easily go to the sessions files and edit it directly as follows:

 

  if (STORE_SESSIONS == 'mysql') {

    if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {

      $SESS_LIFE = 86400; // was 1440 (24 minutes)

    }

 

And this works in my other stores. But for some reason it does not work in this multi store site. I suspect that there is some unique code somewhere in this contribution that overrides that command line in sessions.php Perhaps something not unlike the code you cited. I suspect Hobbs knows what it is and put it there on purpose. I'm just waiting for him to pop in and hopefully clue us in. On the other hand I have searched high and low in the code and the database and can't find it so I shouldn't be surprized if he didn't put it there and doesn't know.

 

Maybe there's a clue in that code itself. what is that second if all about?

 

changing the /admin/includes/functions/sessions.php is all I do. Perhaps your other host has values defined that limit your changes. There is no unique code that I've hidden -- sorry to disappoint!

Link to comment
Share on other sites

Hey Hobbs,

Next time your poking around over here please consider this......

Sometimes it is just dandy if your customer is informed of all your stores and is happy to be part of a multistore family. In this case you could just install the multiple newsletter function like i just did and they could choose which newsletters (presumably identified with their respective stores) tha the customer wanted. And you and the custoemr are happy to only have one record for all stores.

 

Then there are the other cases where you prefer that the customers are not one for multiple stores but that only the inventory is one for multiple stores. Even these stores are so seperate in their approaches you don't even want to share categories. All you want to share is the product table so that you can keep one inventory. So my question is, how would I tell two stores with different databases to share a product table. In other words, how would I tell store A to use database B for customers?

 

I can't find in the code where the table names latch onto the database name and thus where I could doctor the code. It seems what would work well is a hack to have two database specs in the config file and you might have them both the same or you might have them different if you wanted to share a product database, or in the case of multistore where sharing is defaul for everything, use it the opposite way, to not share everything and only share hte product table.

 

Anyway, please let me know if you think this makes sence and if you have any clues how an amateur might make this hack easily or if you like the idea so much you think you might do it someday.

 

Cheers!

 

The quickest way to do what you are asking would be to create multiple customer, customer_info, address_book, etc. tables for each store and define them in database_tables for each store instance.. but then that screws up the uniqueness for some of the customer_id fields e.g. in orders tables... I have no current plans to implement customer per store functionality.

Link to comment
Share on other sites

dont feel bad....ive been informed that it is a known bug and might be resolved in a future release....ive played and played and banged my head into the wall for days trying to resolve it to no avail.....help may be on the way though....

 

thanks....

 

maybe someone else has already integrated the newsletter into a multi store environment? osjunkie maybe? dunno....

 

The bug that doesn't save the distributors_id into the orders_products table has been confirmed. The fix is simple:

 

in catalog/includes/classes/price_schedule.php

 

add

 

p.distributors_id,

 

to the list in the sql statement on line 141. This has been noted and fixed for the next release.

Link to comment
Share on other sites

The bug that doesn't save the distributors_id into the orders_products table has been confirmed. The fix is simple:

 

in catalog/includes/classes/price_schedule.php

 

add

 

p.distributors_id,

 

to the list in the sql statement on line 141. This has been noted and fixed for the next release.

 

 

alright....i'll start once again by saying thanks to hobbzilla for the great contribution and all the time he has put into it......

 

that said i will try to say the rest as tactfully as i can......

 

i sent hobbzilla the following email on april 30th:

 

say....i dont know if youve had time to work on the distributor_id problem yet 
or not but i hope you didnt waste much time on it....i sure have but my 
personality wont let me rest when i cant solve a problem and i view it as a test 
or challenge to my wit and intelligence and have trouble thinking of little else 
until i can work through the issue.....

well i think i solved the "bug"....

if you could give it a try sometime when you have a chance and let me know if my 
fix solves it on your end too that would be great....also please let me know if 
you can think of anything else that might be affected by my change or any other 
files that might need to be tweaked to make this a "complete" 
fix.....

it was driving me nuts that i couldnt find a place where all the 
"variables" in the sql array were being initiated but figured that 
they must be being defined somewhere i couldnt see because all the other parts 
of the "$products_array[] = array('id' => $products_id," on line 
353 of the shopping_cart.php file and all the parts of the " 
$sql_data_array = array('orders_id' => $insert_id," on line 174 of the 
checkout_process.php file were all coming through just fine EXCEPT for our damn 
distibutors_id or distrib_id so i finally saw in the shopping_cart file where 
you had //edited out lines 335-349 and finally read that the "/* Handled in 
PriceFormatter" line and searched for PriceFormatter with Advanced find and 
replace and presto.....

long story short.....

I added "p.distributors_id," into the query under the "function 
loadProduct($product_id, $language_id=1)" line 139 in the damn 
price_schedule.php file and bam it seems to work.....i almost jumped for 
joy....forgive me but this things been driving me nuts.....

so line 139-148 of price_schedule.php is now:

 function loadProduct($product_id, $language_id=1)
 {
   $sql="select pd.products_name, p.products_model, p.products_image, 
p.products_id, p.manufacturers_id, p.distributors_id, p.products_price, 
p.products_weight, p.products_qty_blocks, p.products_tax_class_id, IF(s.status = 
'1' AND s.stores_id = '" . STORES_ID . "', 
s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status 
= '1' AND s.stores_id = '" . STORES_ID . "', 
s.specials_new_products_price, p.products_price) as final_price from " . 
TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on 
p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . 
" pd left join " . TABLE_SPECIALS . " s on p.products_id = 
s.products_id and s.stores_id = '" . STORES_ID . "', " . 
TABLE_PRODUCTS_TO_CATEGORIES . " p2c INNER JOIN " . 
TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id where 
p2s.stores_id = '" . STORES_ID . "' AND p.products_status = '1' and 
p.products_id = '" . (int)$product_id . "' and pd.products_id = 
'" . (int)$product_id . "' and pd.language_id = '". 
(int)$language_id ."'";

   $product_info_query = tep_db_query($sql);
   $product_info = tep_db_fetch_array($product_info_query);
   $this->parse($product_info);

   return $product_info;
 }

just added p.distributors_id into the mix...

hope that all made sense.....

im gonna try to "break" it now in all the ways i can think to see if 
its really working right......

more later.....

let me know.....

thanks and sorry for the long email.....

thanks again for the great contribution and all your time and effort....

 

now im a true believer in the powers of synchronicity and perhaps hobbzilla actually "solved" this bug himself before my email to him but i never recieved a reply so im assuming that it was my email that "solved" the bug....

 

why do i even bring this up...well number one because im having a terrible day but number two mainly because i spent 10 or 15 hours trying this and that and beating my brain up before i stumbled upon the answer and in this world of open source sharing where little or no compensation is ever received its the kudos and the gratification that comes from solving problems that makes me happy and attributing proper credit where credit is due seems only polite.....

 

again maybe hobbzilla figured this on out on his own and if so sorry for this post but i just needed a little ego gratification as solving problems like these drives me crazy until it finally works as you can see from my email....

 

thanks again to hobbzilla for all his fine work and continued support of this contribution.....without his work i would have had no bug to solve in the first place and his contribution has certainly saved me weeks if not months of work, countless hours and precious time and money....so please dont take this post as an insult......i probably shouldnt even post this now but i typed it so here it is.....

 

and for anyone who read this far and who might be concerned about or using the distributors functions of this contribution......i am actively modifying the orders.php file to only show those products in an order that are assigned to a specific distributor...ie store....ie admin....so that they can edit their products within an order that contains item from multiple store or distributors....also allow changing the status on a per product basis rather than a per order basis so that say you are really using different physical locations to ship items in an order that when one location ships a product they can mark just that product shipped.....if that makes sense......sorta like the packing slip function.....im about half way there already but maybe the first half was the easy half.....

 

if there is any interest in this please let me know and i will post my modifications....

 

i am using this in a one store rules all type setting where i will have other small stores around the country logging in as admins but only one main store is ever available to the customer so these changes make sense to me.....

 

cheers to hobbzilla and osc once again.....

 

you avoding me osjunkie? or just missing my pms and request to contact me? just wondering....hope all is well......

 

later......sorry for the long post......

 

and please remember to donate to hobbzilla if you use this contribution....thats what this stuffs all about......a mega-pack of diapers runs about 15 bucks.....his donation button is in his install instructions.......it only seems proper if you are profiting from this contribution to return the favor.....

Link to comment
Share on other sites

YES !

New Shops are copied from the default shop and I changed the config settings in "configure.php" which is located in each folder:

 

You can take a look at this:

 

http://www.runweb.de/multishop/catalog/

 

http://www.runweb.de/multishop/shop1/

 

http://www.runweb.de/multishop/shop2/

 

You see - all is working but the image size of shop1 and shop2 is wrong...

 

:'( :'( My version of Multi Store is still not working as you see - and I don`t know where is the error....???

OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Link to comment
Share on other sites

:'(  :'(  My version of Multi Store is still not working as you see - and I don`t know where is the error....???

 

In admin after selecting each store, the values loaded from the configuration table are different.. have you double checked the image size property in there? If either height or width is blank it will use the images default size.. this is not a Multi-stores problem.

Link to comment
Share on other sites

In admin after selecting each store, the values loaded from the configuration table are different.. have you double checked the image size property in there?  If either height or width is blank it will use the images default size.. this is not a Multi-stores problem.

 

 

In default store i have defined only the widht (height is blank) in admin section - and this works in my default store.

 

But when I switch to a multi store no image definitions are working - not matter what is set in images width/height.

OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Link to comment
Share on other sites

tahuti,

You can rest assured your name has already been listed in the changes.txt file.  Sorry I didn't mention you specifically in my previous post.

 

sorry to be so petty and selfish....my ego gets the best of me at times.....thats why i tried to soften the post with all the praise.....

 

thanks for all your work.....

 

later.....

Link to comment
Share on other sites

changing the /admin/includes/functions/sessions.php is all I do.  Perhaps your other host has values defined that limit your changes.  There is no unique code that I've hidden -- sorry to disappoint!

 

Thanks Ryan,

Actually it is the same host, same domain, just a different folder and a different version of osc. But after all this fuss it seems that it is some quirk on my laptop, perhaps a cookie issue, because now that I am working from a different computer all is well. It confuses me that the same domain hosted on the same server but just a different installation of osc in a different folder was responding differently. My only guess is that the admin contribution in MS somehow uses a different cookie and somehow I had it blocked by accident or some other quirky thing. Anyway, no matter.

Thanks for clearing that up though.

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

To be honest, the newsletter module is _very_ basic. I don't use it for e-mailing customers.. therefore it has never been a priority to get "multi-store-ified".

 

With a little effort, and using the stores_id from customers_info table you should be able to seperate customers based on referring store.. however right now customers are not on a per store basis.. so perhaps then the best way would be to send the e-mail out based on the store that is "active" in the admin.

 

Thanks Ryan,

Yes the newsletter mod is way too basic. I installed newsletter index contribution so at least I can have multiple newsletters. Its decent.

 

Thank you for pointing out the stores_id field. That could make a hack pretty easy, especially one with the newsletter index contribution. Well easy for anyone who knows what there doing anyway. For me that's another story.

 

But maybe I don't need a hack at all. Are you saying that if I send a newsletter out now from admin that it will only go out to the the customers whos store_id matches the active store in admin? Or are you saying that would be an easy hack to make that happen? Because that is a perfect solution. If it is a hack, and if you can give me a clue how to do it, or even better - instructions, then I can add it to the newsletter_index contribution and then I can sent that to you so you can add that to the ms contribution, if you want.

 

By the way, what will happen if a customer logs into a second store? Will it add another number to the stores_id field so instead of showing say "1" it will show "12" to indicate the customer has been in store 1 and 2? Or is it just to show which store they came from originally?

 

Thanks for your support,

Edward

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

Hello again Ryan,

 

What I want to address here is where I have one target market, one store to present to the world, but multiple shipping locations and thus multiple inventories.

 

I have MS Vendors integrated in my installation but I can't see if this addresses that need or not. I have distributors who each have their own inventory of the same items, i.e. when shipping from their locations, their inventory has to be depleted not mine. It looks like the vendors integration was meant to somehow address this but I don't see how. Does it? Oh and does Vendors work internationally or just domestically?

 

If MS Vendors is not the cure then perhaps I will create separate inventory items for each warehouse and use multi-stores to set-up different stores for each warehouse and only show in each store the inventory in that location.

 

Thanks for your support

Edward

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

Hey Ryan,

 

I want to extend a special thank you for piping over easy populate. That makes life so much easier. I wish I could hire you for my company!

 

Here is a question to you or to anyone that is down with MS technology.

 

Since you have multishop cabability most likely you will probably be selling different products in each shop. In which case most of the virtual stores that drop ship will be using different distributors with many warehouses with different prices and quantities.

 

More and more distributors are offering retailers downloadable price files, hense the need for Easy Populate to keep the the products updated for price / qty ...etc.

 

The question is how hard would it be to whip something up to manage different distributors per product information?

 

Example would be:

 

IBM THINK PAD R500 NOTEBOOK COMPUTER

Manufacturer# IB-MN-03-393

 

DISTRIBUTOR A

Sku A: 329129

Price A: $3000.00

Warehouse Qty A1: 2

Warehouse Qty A2: 28

Warehouse Qty A3: 0

 

DISTRIBUTOR B

Sku B: 938828

Price B: $2888.00

Warehouse Qty B1: 22

Warehouse Qty B2: 8

Warehouse Qty B3: 0

 

You get the picture. And on the product page it would choose the distributor with the lowest price, or the closest to the customer.

 

Is this a big challege? Is it doable? What do you think about this proposal?

 

I personally thing this would add a lot of power to this system and if you could get live feeds to distributors you could easily hook up some XML and have real time information on the site.

 

Cheers,

 

Brad

Link to comment
Share on other sites

Summary to clear things up:

 

Realtionships:

 

Many Products = Many Distributors = Many Warehouses = Many Qty = Many Skus = Many Costs

Many Products = One Manufacturer Number

 

The Warehouses also will be scattered all over so address information might be nice to creat distance relationship with the customer.

 

I am asking too much? lol sorry if I am a big dreamer

Link to comment
Share on other sites

help one of my stores works the other I get.

 

Information

Table 'apedavi_cc4u_os.TABLE_INFORMATION' doesn't exist

 

what I do wrong ?

 

Probably you just need to go to your store that doesn't work's /includes/database_tables.php file and change the configuration table to match the name of the configuration table you are using in the store that doesn't work.

 

define('TABLE_CONFIGURATION', 'configuration');

 

'configuration' should match what you set up the name for the store to be in multistores set-up for that store.

I have moved on from oscommerce to magento and no longer monitoring this site.

Link to comment
Share on other sites

help one of my stores works the other I get.

 

Information?

Table 'apedavi_cc4u_os.TABLE_INFORMATION' doesn't exist

 

what I do wrong ?

 

could be a few things:

 

1. did you follow step 4 in the instructions exactly....the parts "'configuration table' are required fields." AND "I highly suggest checking "Insert default configuration table" (otherwise you must copy existing configuration table, name it the same as defined here, change STORES_ID in the copied table to the corresponding stores_id in the stores table)." are important....

 

2. or maybe step 5 "Define WS & FS paths for stores created above"...did you define these for both stores?

 

just trying to guess to help out.....

 

the obvious answer is that that table doesnt exist and it needs to exist.....i case you didnt understand what the error was saying....

 

which store doent work.....main default store or the second store you created?

 

...well i see Dhananjaya just beat me to a reply while i was typing this so now you have multiple choices to try....later....Dhananjaya's post regards what i say in my number 1 and step 4 in the instructions.....

Edited by tahuti
Link to comment
Share on other sites

I have installed the Multi-Stores contribution version 1.7 and it has been working perfectly. I have recently added the All Products contribution to my store. This contribution lists all the products on the one page with images and prices. My problem is that it lists the entire product range from ALL my stores and not the ones that are exclusive to that store.

 

This obviously happens because it calls up the list from the 'products' table. Can somebody help me to alter the file below so that it can display only the products from that store and not all the products from all the stores

 

Thanks in advance

Ian

 

<?php

 

$languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");

while ($languages = tep_db_fetch_array($languages_query)) {

$languages_array[] = array('id' => $languages['languages_id'],

'name' => $languages['name'],

'code' => $languages['code'],

'image' => $languages['image'],

'directory' => $languages['directory']);

}

for ($i=0; $i<sizeof($languages_array); $i++)

{

$this_language_id = $languages_array[$i]['id'];

$this_language_name = $languages_array[$i]['name'];

$this_language_code = $languages_array[$i]['code'];

$this_language_image = $languages_array[$i]['image'];

$this_language_directory = $languages_array[$i]['directory'];

echo " <tr>\n";

 

$products_query = tep_db_query("select s.specials_new_products_price, p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and products_status = '1' order by pd.products_name");

$products_array = array();

 

echo " <tr>\n";

while($products = tep_db_fetch_array($products_query))

{

$products_array[] = array('id'=> $products['products_id'],

'name' => $products['products_name'],

'image' => $products['products_image'],

'model' => $products['products_model'],

'manufacturer' => $products['manufacturers_name'],

'price' => $products['products_price'],

'tax' => $products['products_tax_class_id'],

'special' => $products['specials_new_products_price']);

}

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...