David,
First of all, HAPPY NEW YEAR !
How can i add the product count on my categories A-Z page ?
Mike
I followed the code on Node 458, but that does not show the product count in my categorie A-Z pages. I only see the brackets.
How do i make the code you posted here show it like Electronics(335)
Hi Mikey,
Does the above version on this page work?
Cheers,
David.
Yes it works, but it shows as the product count as Electronics (335)
Hi Mikey,
I understand - ok, instead of the replacement code above, replace with this:
$sql = "SELECT COUNT(*) AS productCount FROM `".$config_databaseTablePrefix."products` WHERE category='".database_safe($product["category"])."'";
database_querySelect($sql,$rows2);
$productCount = $rows2[0]["productCount"];
$item["extra"] = "(".$productCount.")";
$item["name"] = $product["category"];
(so the last line is the same as the original)
Then, in includes/atoz.php, look for the following code on line 43:
print "<p><a href='".$item["href"]."'>".$item["name"]."</a></p>";
...and REPLACE this with:
print "<p><a href='".$item["href"]."'>".$item["name"]."</a> ".$item["extra"]."</p>";
That should do the trick!
Cheers,
David.
Hi Mike,
HNY to you too! In categories.php, look for the following code on line 16:
$item["name"] = $product["category"];
...and REPLACE this with:
$sql = "SELECT COUNT(*) AS productCount FROM `".$config_databaseTablePrefix."products` WHERE category='".database_safe($product["category"])."'";
database_querySelect($sql,$rows2);
$productCount = $rows2[0]["productCount"];
$item["name"] = $product["category"]." (".$productCount.")";
Cheers,
David.