I want to put different featured products in each individual installation folder. The way it is now, if I put in backpack items in the backpack featured admin they show up in all my folders. How do I seperate them?
Morning David,
I have separate installations like described in the node that gives details on setup. All folders work off of one table. No seperate $config_databaseTablePrefix. I did that because I have 200+ folders and wanted to keep the maintenance level down. The only changes I would need to make to each folder would be the featured products that way.
That is likely my problem. I have it set up so all my folders work off of one css file and two menu files.
Is it possible to use the user_footer_before file to bring up random products say 3-4 products for that product group and then when I get traffic and more information to bring up the most popular products for that product group. That would effectively eliminate the featured products updates also. Automation is key you know.
I have put a lot of work into this and really don't want to see it wasted. So anything you could come up with would greatly be appreciated.
I can set up another file to do this since I wanted to use the footer_before file for something else.
You can see the site at shop.purecountryhiking.com. Anyone else reading this I would appreciate some feedback on the site also. It isn't live yet but was planning on this weekend, first off the week at the latest. It has a test feed in it right now. Finishing up my feed changes and sku matchups locally first then feeds will go live.
Also has anyone used phpscheduler before, and any feedback.
Thanks again,
Allan Lehman
Hi Allan,
Random featured products is certainly an option; and sounds like a good way to go about it, although it should be relatively easy to modify the featured products system so that you could, for example, prefix each featured products with the relevant directory (installation).
<?php
$sql = "SELECT name,1 AS sequence FROM `".$config_databaseTablePrefix."products` ORDER BY RAND() LIMIT 4";
if (database_querySelect($sql,$rows))
{
$sqlNames = array();
$sqlCase = "CASE name";
foreach($rows as $featured)
{
$sqlNames[] = "'".$featured["name"]."'";
$sqlCase .= " WHEN '".database_safe($featured["name"])."' THEN ".$featured["sequence"];
}
$sqlCase .= " END AS sequence";
$sqlIn = implode(",",$sqlNames);
$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";
database_querySelect($sql,$rows);
$featured["products"] = $rows;
foreach($featured["products"] as $k => $product)
{
if ($config_useRewrite)
{
$featured["products"][$k]["productHREF"] = "product/".tapestry_hyphenate($product["name"]).".html";
$featured["products"][$k]["reviewHREF"] = "review/".tapestry_hyphenate($product["name"]).".html";
}
else
{
$featured["products"][$k]["productHREF"] = "products.php?q=".urlencode($product["name"]);
$featured["products"][$k]["reviewHREF"] = "reviews.php?q=".urlencode($product["name"]);
}
}
}
if (isset($featured)) require("html/featured.php");
?>
This is exactly the featured products code from index.php but with a different SQL query on the first line. However, as you are using the same database for each installation this may need to be changed further, for example by category:
$sql = "SELECT name,1 AS sequence FROM `".$config_databaseTablePrefix."products` WHERE category='Garden' ORDER BY RAND() LIMIT 4";
...where the category value is different for each installation.
Cheers,
David.
Thanks David,
Exactly what I was looking for and after thinking about it today, that was also what I planned on doing (narrow it down by category for each installation).
This will about complete my modifications for now.
Thanks a ton for your help,
Allan Lehman
Hi,
If they are completely separate installations then each should have its own Featured Products; but it sounds like you are using a hybrid setup... Could you describe how you have setup the database to work across each installation and I'll see what I can suggest...
Double-check of course that in the site in which you edited the featured products the database config was correct. If you're using the same database, make sure each has a unique $config_databaseTablePrefix etc...
Cheers,
David.