Hello
is there a way to display a select group of categories?
i.e. The categories page shows a list of categories from A-Z. I want to have a page that shows only categories A-B, M-O, W and Z for example.
Is this possible?
cheers!
P.
Excellent, thanks David!
Is is also possible to display only selected products as well?
i.e. to display only 'Mens Socks', 'Mens Ties' and 'Garden Tools' for example?
cheers
P.
Hi,
Sure - the alternative SQL for specific categories would be:
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` WHERE category IN ('Mens Socks','Mens Ties','Garden Tools') ORDER BY category";
$config_useRewrite = FALSE;
(strictly speaking an SQL statement isn't required for specific categories - but it keeps the mod to one place!)
Cheers,
David.
to add.
i would like to exclude every category with jewelry.
example
jewelry rings
jewelry bands
I'd like to exclude all jewelry categories.
If a specific keyword (jewelry) is present in the category it would not show.
Hi Alex,
This would depend on the SQL you are using to select catetgories in your top categories mod, but will essentially just be an addition of the WHERE clause:
AND category NOT LIKE '%jewelry%'
If you're not sure, could you psot the SQL you are using and i'll add the modification for you...
Cheers,
David.
Hi,
Yes - you can do this quite easily with a new file. If you make a copy of categories.php and call it, for example, categoriesSelected.php (or perhaps something describing the letters you want), and then in the new file, look for the following code on line 6:
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
...and REPLACE this with:
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` WHERE SUBSTRING(category,1,1) IN ('A','B','M','N','O','W','Z') ORDER BY category";
$config_useRewrite = FALSE;
...of course you can edit the list of letters as required!
Cheers,
David.