Hi David & everybody,
For some reason, I need to allocate some products not in one but in 2 or maybe 3 categories. As I manage manually all categories, it could be easy to create some "virtual" categories with few links leading to search engine results. But unfortunately, it's not possible because keywords I need are not always relevant, or not used in imported feeds. Internal search engine doesn't match exactly the result I expect.
So the point would be to create some individuals pages. Each page would have its own mysql query to grab and show specific products (I know which product I want, and I can find their individual ID in the database). Do you think it's possible, and if yes, how would you carry this out ?
Thanks for your help !
Hi there,
It sounds like the Featured Products "Sections" mod is just what you need...
http://www.pricetapestry.com/node/3243
This enables you to create arbitrarily categorised groups of featured products that can be called with just a slight change to the SELECT sql. More details on the above page; but essentially you can manage the sections by prefixing product names with section/ for example:
bluewidgets/Product 1
bluewidgets/Product 2
redwidgets/Product 3
redwidgets/Product 4
You mentioned creating individual pages; based on the code from the above thread, a complete page including the standard Price Tapestry includes / header / footer could be created as follows - continuing the above example for a Blue Widgets" specific page:
blue-widgets.php
<?php
require("includes/common.php");
$header["title"] = "Blue Widget Price Comparison";
$header["meta"]["keywords"] = "Blue Widgets";
$header["meta"]["description"] = "A selection of the best Blue Widget deals available";
require("html/header.php");
require("html/menu.php");
require("html/searchform.php");
$featuredproducts_category = "bluewidgets";
$sql = "SELECT * FROM `".$config_databaseTablePrefix."featured` WHERE name LIKE '".$featuredproducts_category."/%' ORDER BY sequence";
if (database_querySelect($sql,$rows))
{
$sqlNames = array();
$sqlCase = "CASE normalised_name";
foreach($rows as $featured)
{
$featured["name"] = str_replace($featuredproducts_category."/","",$featured["name"]);
$featured["name"] = tapestry_normalise($featured["name"]);
$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 normalised_name IN (".$sqlIn.") GROUP BY normalised_name ORDER BY sequence";
database_querySelect($sql,$rows);
$featured["products"] = $rows;
foreach($featured["products"] as $k => $product)
{
$featured["products"][$k]["productHREF"] = tapestry_productHREF($product);
$featured["products"][$k]["reviewHREF"] = tapestry_reviewHREF($product);
}
}
if (isset($featured)) require("html/featured.php");
require("includes/footer.php");
?>
...would display Product 1 and Product 2 in the standard Featured Products template...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com