hi david.
not sure if this is possible but here goes.
is it possible to have 1 master website and 4 mini websites where the 4 mini websites pull certain categories from the master website. so for instance
Master website has the following categories:
Games
Gadgets
Flowers
Electronics.
then the 4 mini websites does this:
mini site 1 pulls the games categories
mini site 2 pulls the gadgets categories
mini site 3 pulls the flowers categories
mini site 4 pulls the electronics
then whenever i update the flowers on the main site it also updates the flowers categories on site 3
all the sites will be on the same server.
hope you get that :)
thanks
paul
hi dave
did all the above but dosnt seem to pull the categories from the main site
ah no its pulling all the categories now, i just want it to say pull the cateogory flowers?
the error i get also when i click on a category:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/gifttag/public_html/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gifttag/public_html/includes/database.php on line 26
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/gifttag/public_html/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gifttag/public_html/includes/database.php on line 26
Warning: Cannot modify header information - headers already sent by (output started at /home/gifttag/public_html/includes/database.php:21) in /home/gifttag/public_html/html/header.php on line 12
http://www.gifttag.co.uk/category/Flowers/
Hi Paul,
I think maybe I have mis-understood what you are trying to do - could perhaps explain another way, with example URLs perhaps?
With the modifications described above, your "mini" sites are always going to see the entire database on the categories / merchants / brands pages - but i'm assuming if you're dedicated an installation to 1 category then you won't be using the categories page so this doesn't matter - all the changes above will do is limit the search functionality to the category specified in $config_category...
Cheers,
David.
hi
yes sorry for confusion
ok ill try and explains
i have
domains A will will have all the categories and feeds installed.
so i will make 3 categories (category mapped)
flowers - this will have flower merchants categories
gadgets - this will have gadgets merchants categories
clothes - this will have clothes merchants categories
then
Domain B: this domain is a flowers site so will pull the categories Flowers from domain A only.
Domain C: this domain is a gadgets site so will pull the categories gadgets from domain A only.
Domain D: this domain is a clothes site so will pull the categories clothes from domain A only.
then each mini site will only shows the the categories specic for that site.
hope that is clear to understand :)
hi dave any ideas on the above or will have to have all sites share the same categories
Hello Paul,
I think I understand and it should be straight forward, but what I need to know is what you want to see on the mini-sites?
When you create the mini-sites with the same database configuration, the category index will always show all the categories; but I assume you do not need this page; so that doesn't matter (you can remove the link to categories.php from your index.php page)
That means all you need to is modify search.php to restrict all queries to the category. With the modifications described above, are searches now working only within the category set in $config_category?
Cheers,
David.
yes the mini site will only display the categories specified in the config file(down the left) but if the user does a search for anything unrelated to the mini site then im not bothered what it pulls from the main database, it is the initial featured products and ctegories i want to display on the min sites.
Hi Paul,
As long as each mini-site is just one category (you implied that you would map categories nicely on the master site), that should be what the modifications described above achieve; with the exception of "Featured Products".
For the Featured Products to be restricted to the category in the new $config_category variable, look for the following code on line 51 of index.php:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, ".$sqlCase." FROM `".$config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") GROUP BY name ORDER BY sequence";
...and replace this with:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, ".$sqlCase." FROM `".$config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") AND category='".database_safe($config_category)."' GROUP BY name ORDER BY sequence";
Cheers,
David.
Hi Paul,
In theory this should be straight forward - just install your "mini-sites" with exactly the same database values in config.php ($config_baseHREF will of course be different); and then just a small number of code hacks in each site should force them to work only within the specified category.
Things like the category index of course would be the same on all installation, but you could just remove the link to the category index so that this is never displayed. After that, it's just a case really of adding "AND category=''" to the various SQL statements in search.php to ensure that it is confined to the category required.
To keep it simple, I would start by adding the category required to config.php, so that is all you need to change on each of the mini-sites, for example:
$config_category="Electronics";
Then, in search.php, try the following replacements (this is based on the latest distribution, so start with that for your mini-sites).
Line 41:
$where = " ".$parts[0]."='".database_safe($parts[1])."' ";
Repalce with:
$where .= " AND category='".database_safe($config_category)."' ";
Line 79:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, MATCH name AGAINST ('".database_safe($parts[0])."') AS relevance FROM `".$config_databaseTablePrefix."products` WHERE MATCH name AGAINST ('".database_safe($parts[0])."') GROUP BY name";
$sqlResultCount = "SELECT COUNT(DISTINCT(name)) as resultcount FROM `".$config_databaseTablePrefix."products` WHERE MATCH name AGAINST ('".database_safe($parts[0])."')";
Replace with:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, MATCH name AGAINST ('".database_safe($parts[0])."') AS relevance FROM `".$config_databaseTablePrefix."products` WHERE MATCH name AGAINST ('".database_safe($parts[0])."') AND category='".database_safe($config_category)."' GROUP BY name";
$sqlResultCount = "SELECT COUNT(DISTINCT(name)) as resultcount FROM `".$config_databaseTablePrefix."products` WHERE MATCH name AGAINST ('".database_safe($parts[0])."') AND category='".database_safe($config_category)."'";
Line 94:
$where = implode(" AND ",$wheres);
Replace with:
$where = implode(" AND ",$wheres)." AND category='".database_safe($config_category)."'";
That should get you close...!
Cheers,
David.