Forums / All Other Contributions/Addons / MultiSite Module Support Thread

MultiSite Module Support Thread

Started by gerome on 23 Apr 2007, 10:24 AM · Views: 581,865

Results 161 to 180 of 2,247
3 Aug 2007, 3:57 PM
#161
gerome avatar

gerome

Zen Follower

Join Date:
Sep 2006
Posts:
100
Plugin Contributions:
0

MultiSite Module Support Thread

I just finished to work on an admin tool for the multisite module.

You can visualised the categories for each sites and change them around from the admin section...

You can find it here

http://www.medea.co.uk/dev/

Let me know what you think of it.

3 Aug 2007, 5:13 PM
#162
stav avatar

stav

New Zenner

Join Date:
Oct 2004
Posts:
39
Plugin Contributions:
0

Re: MultiSite Module Support Thread

WoW!!! :D Perfect !!!! You are tha man.
This will save us much more time on the Categories/Sites.
Very well done.

3 Aug 2007, 5:28 PM
#163
stav avatar

stav

New Zenner

Join Date:
Oct 2004
Posts:
39
Plugin Contributions:
0

Re: MultiSite Module Support Thread

After some testing the tool is working pretty well,
one limitation is that is not multilingual supported, maybe in next version :).

4 Aug 2007, 1:26 AM
#164
lina0962 avatar

lina0962

Zen Follower

Join Date:
Jun 2006
Posts:
403
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Hello, Gerome:

I figured out the sidebox problem. Thank you for your help!

My two site https://www.loveinrose.com and https://www.wholesale.loveinrose.com

The site_name I set in config_sites folder is 'loveinrose' and 'wholesale.loveinrose'.

is the following SQL query right?

UPDATE categories_description
SET categories_description = CONCAT("<!--loveinrose-wholesale.loveinrose-->",categories_description)
WHERE categories_description NOT LIKE "%-loveinrose-wholesale.loveinrose-%"

I run this query in Admin->Tool->SQL Query Executor, it failed.

What part did I do wrong? Thank you very much!

Lina

4 Aug 2007, 2:06 AM
#165
stav avatar

stav

New Zenner

Join Date:
Oct 2004
Posts:
39
Plugin Contributions:
0

Re: MultiSite Module Support Thread

lina0962:

I run this query in Admin->Tool->SQL Query Executor, it failed.

What part did I do wrong? Thank you very much!

Lina

Lina! , Gerome made today an Admin Tool for you :), go and check it it that will help you with the Categories/Sites.

4 Aug 2007, 8:21 PM
#166
lina0962 avatar

lina0962

Zen Follower

Join Date:
Jun 2006
Posts:
403
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Hello, Gerome and Stav;'

Thank you very much for the help! I downloaded the admin tool and it worked beautifully on my adim. Great tool! Thank you!

Just have one more question: I have 16 cateogries, and actually I want both my 2 sites have the same number of categories: each site has 16 categories. (they are shadow sites, their only difference is their outlook)

What should I do make this happen? Thanks a lot!

Lina

4 Aug 2007, 11:19 PM
#167
stav avatar

stav

New Zenner

Join Date:
Oct 2004
Posts:
39
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Just add loveinrose-wholesale.loveinrose in input box in admin tools for all 16 categories.
If you have two languages then you can edit all 16 categories description and in the second language on the top of the text area type <!--loveinrose-wholesale.loveinrose-->. without using the visual editor.

5 Aug 2007, 3:19 PM
#168
magnus_wester avatar

magnus_wester

New Zenner

Join Date:
Jul 2007
Location:
Stockholm, Sweden and Palermo, Italy
Posts:
6
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Hi Gerome,

I wonder if you can quickly put together a list of the most important things that CAN NOT be different across the various sites running off the same installation with the MultiSite Module.

Since all the sites share the same shopping cart, I assume they must be using the same currency. I have also seen posts that state that they must be using the same language. But what about taxes, shipping etc, can this be set per site or are these also per shopping cart (and per installation) settings?

Or would it simply be easier to say that almost everything qualifying as a "business rule" (in contrast to site templates etc) must be the same for all the sites?

6 Aug 2007, 8:50 AM
#169
gerome avatar

gerome

Zen Follower

Join Date:
Sep 2006
Posts:
100
Plugin Contributions:
0

Re: MultiSite Module Support Thread

  • Same currency.
  • Multisite is not compatible with multi languages but will be in the next version (released tomorrow)
  • I think that different taxes should be compatible but I never tried to be honest.
  • You can use different shipping modules for each site
  • You can use different payment module for each site
  • You can change anything that is in the configuration section of the admin section (including the company information).

If by "business rule" you mean payment methods, tax/shipping, currency and company information, I would say that

About the new version:

  • it will also allow to desactivate the cat_filter for some sites (and then allow all the categories to be display).
    It will also allow to specify a different CATEGORIES_ROOT.
7 Aug 2007, 3:23 PM
#170
gerome avatar

gerome

Zen Follower

Join Date:
Sep 2006
Posts:
100
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Version 0.4 is released.

It can be downloaded from here:
http://www.medea.co.uk/dev/

Last changes:

  • lots of minor bugs fixed
  • Admin tools in: Tools -> Multisite Tools allows an easy management of categories
  • Multi languages now supported
  • cPath calculation integrated with the category filter
  • The category filter can now be desactivated with this line:
define('ALLOW_CAT_FILTER','no'); //Desactivate the cat_filter for a site
  • You can now change the root category of your store by writing this line in your config files:
define('CATEGORIES_ROOT','21'); //root categories is 21 for this site
8 Aug 2007, 1:17 AM
#171
stav avatar

stav

New Zenner

Join Date:
Oct 2004
Posts:
39
Plugin Contributions:
0

Re: MultiSite Module Support Thread

One sindax error.
File:
includes/functions/extrafunctions/cat_filter.php

Line: 76
from
INNER JOIN categories_description c
to
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd

Line: 80
from
INNER JOIN categories as c
to
INNER JOIN ".TABLE_CATEGORIES." as c

For me, in this new version all filtering with multilangual installation working fine exept the main_page=products_new

Congratulation Gerome :)

9 Aug 2007, 1:35 AM
#172
hipctech avatar

hipctech

Totally Zenned

Join Date:
Oct 2004
Location:
Surrey, BC, Canada
Posts:
1,466
Plugin Contributions:
1

Re: MultiSite Module Support Thread

Hello Gerome,

I have added all my products through Easy Populate. I don't know of another module that would do that. The thing is that when I add all my products with this module the master_categories_id is not populated so I run into problems with listing my products.

I found a quick fix though. in the cat_filter.php function I changed line 90 with the following code:

$sql = substr($sql,0,$add_pos).
		" INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
		ON (p.master_categories_id = cd.categories_id
		AND cd.language_id=".$_SESSION['languages_id']."
		AND cd.categories_description LIKE '%-".SITE_NAME."-%') ".
		substr($sql,$add_pos);

to this:

if(preg_match("/from zc_products_description pd, zc_products p left join zc_manufacturers m on p.manufacturers_id = m.manufacturers_id, zc_products_to_categories p2c left join zc_specials s on p2c.products_id = s.products_id/",$sql))
{
	$sql = substr($sql,0,$add_pos).
			" INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
  			ON (cd.categories_id = p2c.categories_id
  			AND cd.language_id=".$_SESSION['languages_id']."
  			AND cd.categories_description LIKE '%-".SITE_NAME."-%') ".
			substr($sql,$add_pos);
} else {
	$sql = substr($sql,0,$add_pos).
			" INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
  			ON (p.master_categories_id = cd.categories_id
  			AND cd.language_id=".$_SESSION['languages_id']."
  			AND cd.categories_description LIKE '%-".SITE_NAME."-%') ".
			substr($sql,$add_pos);
}

I just made it to check after the products_to_categories table instead of the products.master_categories_id field. It has solved the problem for me for now. The problem that I should really solve is the one with EP but that is in the future.
I hope that this helps someone.

God bless. Amazing Discoveries.

9 Aug 2007, 1:46 AM
#173
hipctech avatar

hipctech

Totally Zenned

Join Date:
Oct 2004
Location:
Surrey, BC, Canada
Posts:
1,466
Plugin Contributions:
1

Re: MultiSite Module Support Thread

Actually forget about the earlier post. The Lord answered my prayers even better and led me to this post: Here

Where DrByte tells how to reset the master_categories_id. so it is all solved without changing your code!

Praise the Lord :smile:

9 Aug 2007, 8:26 PM
#174
hipctech avatar

hipctech

Totally Zenned

Join Date:
Oct 2004
Location:
Surrey, BC, Canada
Posts:
1,466
Plugin Contributions:
1

Re: MultiSite Module Support Thread

I think I found a bug in the cat_filter.php function on line 76. I didn't have time to check the forum but I downloaded the latest version.

This is the warning:

1146 Table '[#database#].categories_description' doesn't exist
in:
[select p2c.categories_id from zc_products p, zc_products_to_categories p2c 
INNER JOIN categories_description cd ON 
(p2c.categories_id=cd.categories_id AND cd.language_id=1 AND cd.categories_description LIKE '%-[#Site_name#]-%') 
INNER JOIN categories as c ON 
(cd.categories_id=c.categories_id 
AND c.categories_status=1)
where p.products_id = '75' and p.products_status = '1' 
and p.products_id = p2c.products_id limit 1]

the table in red is the problem. The code in the function file is at line 76 and php INNER JOIN categories_description cd should be changed to ```php
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd


Same it is with line 80

Thank you for the contribution. 
God bless. Amazing Discoveries.
13 Aug 2007, 8:11 AM
#175
gerome avatar

gerome

Zen Follower

Join Date:
Sep 2006
Posts:
100
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Hi HiPCTech,

Actually, stav signaled this problem last week before you and I fixed it in the version beta 0.4.1 that I released as soon as I heard from it.

You can just swap your cat_filter.php by the one from this new version and it will be solved.

Regards,

Gerome.

HiPCTech:

I think I found a bug in the cat_filter.php function on line 76. I didn't have time to check the forum but I downloaded the latest version.

This is the warning:

1146 Table '[#database#].categories_description' doesn't exist
in:
[select p2c.categories_id from zc_products p, zc_products_to_categories p2c
INNER JOIN categories_description cd ON
(p2c.categories_id=cd.categories_id AND cd.language_id=1 AND cd.categories_description LIKE '%-[#Site_name#]-%')
INNER JOIN categories as c ON
(cd.categories_id=c.categories_id
AND c.categories_status=1)
where p.products_id = '75' and p.products_status = '1'
and p.products_id = p2c.products_id limit 1]
the table in red is the problem. The code in the function file is at line 76 and php
INNER JOIN categories_description cd
should be changed tophp
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd

> 
> Thank you for the contribution. 
> God bless. Amazing Discoveries.
13 Aug 2007, 11:47 AM
#176
stav avatar

stav

New Zenner

Join Date:
Oct 2004
Posts:
39
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Gerome

The filtering for the main_page=products_new don't work for me.
But if i add in includes/templates/template_default/templates/tpl_modules_products_new_listing.php

from

$products_new = $db->Execute($products_new_split->sql_query);

to

$products_new = $db->Execute(cat_filter($products_new_split->sql_query));

The filtering is working OK. but the counting for the split page is not working ok
p.x. (1 to 9 from 21) the counter is showing all the products.

Thesame problem with the counter I have in the feautured products too.
All other filtering working ok.

BTW below is one more filter that is missing for the categories dropdown in product list by manufacturers.

File:
includes/index_filters/default_filter.php

Line:167
from

$filterlist = $db->Execute($filterlist_sql);

to

$filterlist = $db->Execute(cat_filter($filterlist_sql));

Thanks!!.

15 Aug 2007, 1:20 PM
#177
gerome avatar

gerome

Zen Follower

Join Date:
Sep 2006
Posts:
100
Plugin Contributions:
0

Re: MultiSite Module Support Thread

stav:

Gerome

The filtering for the main_page=products_new don't work for me.
But if i add in includes/templates/template_default/templates/tpl_modules_products_new_listing.php

from

$products_new = $db->Execute($products_new_split->sql_query);

> ```php
$products_new = $db->Execute(cat_filter($products_new_split->sql_query));
```The filtering is working OK. but the counting for the split page is not working ok
> p.x. (1 to 9 from 21)  the counter is showing all the products.
> 
> Thesame problem with the counter I have  in the feautured products too.
> All other filtering working ok.
> 
> 
> BTW below is one more filter that is missing for the categories dropdown in product list by manufacturers.
> 
> File:
> includes/index_filters/default_filter.php
> 
> Line:167
> from
> ```php
$filterlist = $db->Execute($filterlist_sql);
```to
> ```php
$filterlist = $db->Execute(cat_filter($filterlist_sql));
```Thanks!!.

This is strange, this page work well for me.

Could you check your file:
includes/modules/pages/products_new/header_php.php

Line 34 should be:
```php
$products_new_split = new splitPageResults(cat_filter($products_new_query_raw), MAX_DISPLAY_PRODUCTS_NEW);
16 Aug 2007, 10:38 AM
#178
magnus_wester avatar

magnus_wester

New Zenner

Join Date:
Jul 2007
Location:
Stockholm, Sweden and Palermo, Italy
Posts:
6
Plugin Contributions:
0

Re: MultiSite Module Support Thread

Many of the people developing or implementing the MultiSite module have already come to grips with the basic characteristics of the module. Others, like myself, are just starting to learn. Perhaps there is a need for a "pre-sales" thread to complement this rather technical "support" thread?

Anyway, I'd like to contribute a few important basics of the MultiSite module. Some of this is already documented elsewhere on this thread, more or less between the lines. If you miss some of this, or its true consequences, you may be in for a bit of a surprise later.

These are the issues that I as a newbie have been facing, and if someone ever creates a tutorial for the MultiSite Module I suggest that this information is included there.

The MultiSite module can save you a lot of time

If you manage multiple web shops, the MultiSite module can save you a lot of time:- You only need to maintain a single Zen Cart installation to host many shops.

  • You can use the same product in more than one shop.
  • A user that is defined in one of your shops can login to any of them.
  • You can provide different company information for each shop.
  • You can use different payment module for each shop.
  • You can use different shipping modules for each shop.There are certain limitations
  • All the shops must use the same currency.
  • To use SSL encryption smoothly you need one IP address per shop.**The same host account is used for all sites

**To reap all the benefits of the MultiSite module you use only one host account, with one common Zen Cart installation, to support all your sites.

All domain names point to the shared host account

If you run site1.com, site2.com and site3.com using the MultiSite module, you will only create a host account for site1.com. The DNS entries for site2.com and site3.com both point to (are parked on top of) site1.com.

All sites use the same folder structure

Since all the domain names point to the same folder (the root folder for site1.com in the example above), any request for site1.com/zencart/ will access exactly the same file as site2.com/zencart/.

All sites are managed using the same Zen Cart Admin tool

It should be obvious to you by now that site1.com/zencart/admin/ and site2.com/zencart/admin/ access exactly the same file. You manage all your sites using the admin tool for the whole Zen Cart installation.

The MultiSite module knows what site to show

When the web server receives a page request, the environment variable $_SERVER['HTTP_HOST'] contains the domain name that was used (e.g. "site2.com"). The MultiSite module uses this information to use the right settings, fetch the right template, show the right categories etc. If the domain name is not correctly defined in the /includes/config_sites/ folder, there is no default - the screen will be blank except for a brief "undefined site" message.

Everything in the sites is shared - every folder, every file

Since site2.com and site3.com point to the folder structure for site1.com, there is no way to create a site1.com/help/ folder without also making the same folder available in the other sites.

If you need a partially separate folder structure for each site you may consider creating site1.com/s1/, site1.com/s2/ and site1.com/s3/. As you place items in the s1, s2, and s3 folders, they of course become available in all three sites at the same time. If you link to them correctly, i.e. site1.com/s1/ but site2.com/s2/ and site3.com/s3/, you maintain the impression of three separate sites. It is fairly unlikely that users will ever notice that they visit an account that hosts all three sites simultaneously.

Even the index page is shared

I use PHP, and so my index page (the page that is shown if someone just enters the domain name like "site1.com") is typically called index.php. In a multisite setup, this file is also shared - the same PHP script will be executed, regardless of what domain name the visitor used.

If you place the Zen Cart in your root folder, the MultiSite Manager will handle this automatically, and always provide the right site. If your site contains other things, it is quite likely that you have created a folder for your Zen Cart installation (e.g. site3.com/zencart/).

In this case you probably need a separate index page for each site. To achieve this, you need to create a script. I use PHP, and this is my new index.php file:

<?php
switch($_SERVER['HTTP_HOST']) {
  case 'site1.com':
    require('site1-index.php');
    break;
  case 'site2.com':
    require('site2-index.php');
    break;
  case 'site3.com':
    require('site3-index.php');
    break;
}
?>

This uses the same technique as the MultiSite Module to show different content for different sites by using a separate index.php file for each site. From this site-unique file you create each site with its own content, templates, CSS files etc.

16 Aug 2007, 1:53 PM
#179
jvoce avatar

jvoce

New Zenner

Join Date:
Jul 2006
Location:
Toronto, ON
Posts:
87
Plugin Contributions:
0

Re: MultiSite Module Support Thread

I've uploaded and configured the new version: 0.4.1 and I replaced all files as suggested, after making sure none were edited, and configured the site switches appropriately. However, when I go to the site store1.salvationarmy.ca this is what appears on the screen:

1054 Unknown column 'CATEGORIES_ROOT' in 'where clause'
in:
[select cd.categories_name from categories c, categories_description cd where cd.categories_description LIKE '%-SITE_NAME-%' AND cd.language_id=1 AND c.parent_id = CATEGORIES_ROOT and c.categories_id = cd.categories_id and cd.language_id='1' and c.categories_status=1]

Any ideas of how to fix this?

16 Aug 2007, 2:08 PM
#180
gerome avatar

gerome

Zen Follower

Join Date:
Sep 2006
Posts:
100
Plugin Contributions:
0

Re: MultiSite Module Support Thread

jvoce:

I've uploaded and configured the new version: 0.4.1 and I replaced all files as suggested, after making sure none were edited, and configured the site switches appropriately. However, when I go to the site store1.salvationarmy.ca this is what appears on the screen:

1054 Unknown column 'CATEGORIES_ROOT' in 'where clause'
in:
[select cd.categories_name from categories c, categories_description cd where cd.categories_description LIKE '%-SITE_NAME-%' AND cd.language_id=1 AND c.parent_id = CATEGORIES_ROOT and c.categories_id = cd.categories_id and cd.language_id='1' and c.categories_status=1]

Any ideas of how to fix this?

Hi Jvoce,

You still need to add that at the begining of your 'configure.php':

include_once('includes/config_sites/sites_switch.php');

Magnus,

Thank you so much for you for your post !! This is of a great help.
I guess I should add that to the documentation of the module right ?

I will do these changes as soon as I have few minutes for it !

Thanks again !