Has anyone configured their site to have a featured products section at a sub-catergoy level? i.e. I have an digital cameras page and i want to show featured digital cameras only and so on for each of my pages.
Regards,
Michael
Thanks David - will give it a try!
Michael @ ThePriceSite
Hi Michael,
The SQL to select the featured products is (line 45 of index.php in the distribution):
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") GROUP BY name";
You could modify that on each of your sub-category pages, for example:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") AND category='Digital Cameras' GROUP BY name";
The products would of course have to have been registered with (in this example) "Digital Cameras" as the category, and would be selected from the list of all featured products.
This might result in a long list of featured products if you are doing this for several categories; so on the homepage you could limit the number of products by using:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `".$config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") GROUP BY name LIMIT 3";
Hope this helps!
Cheers,
David.