Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 07-13-2004 10:20:10

BobGordon
Member
Registered: 01-20-2003
Posts: 10

Calculating Number Of Items In Category

Hi, I have lots of categories and each category has between like 5 and 20 items, and I want to put next to each Category the number of items that are in it. For example "Category (15)"  Anyone know how I could go about doing this?

Thanks,
Bob

Offline

 

#2 07-16-2004 14:46:09

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19850
Website

Re: Calculating Number Of Items In Category

On which page did you need to do this?  Is this in the category list in the layout or on the category pages?


Nick Hendler

Offline

 

#3 07-16-2004 19:37:26

BobGordon
Member
Registered: 01-20-2003
Posts: 10

Re: Calculating Number Of Items In Category

On the category pages.

Offline

 

#4 08-04-2004 10:18:42

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19850
Website

Re: Calculating Number Of Items In Category

In order to do this, open up the file ./cgi-bin/library/modules/ste_cat.pl for editing.  Look in the routine 'ste_cat_desc' and find the lines:

Code:


if ($found_count ne "0") {

&display_print('ste_cat_desc');

} ######### End of if statement.

Change to:

Code:


$category_itemsfound = "0";

if ($found_count ne "0") {

&display_print('ste_cat_desc');

$sql_statement = "

SELECT COUNT(*)
FROM prodxcat
WHERE prodxcat_sec=$dbins_fd_ref

";

my @count = database_call('prodxcat','SELECT',$sql_statement);

foreach $row(@count) {($category_itemsfound) = @$row;}
if ($category_itemsfound <= "0") {$category_itemsfound = "0";}

} ######### End of if statement.

Once you've made that hack, in admin choose to edit the site element named 'Category Heading Display'.  Add this in there:

Code:


(CGIVAR)category_itemsfound(/CGIVAR)

Where you want the items found number.


Nick Hendler

Offline

 

#5 08-24-2004 18:16:00

Steven
Member
Registered: 04-21-2004
Posts: 84

Re: Calculating Number Of Items In Category

webmaster,08/04/2004 10:18:42 AM wrote:

Code:


if ($found_count ne "0") {

&display_print('ste_cat_desc');

} ######### End of if statement.

Hi Nick, I also want to apply this hack, but the code I need to change has some other lines meshed inbetween.  I have this..

Code:


if ($found_count ne "0") {

if ($category_active eq "N") {

$category_descsale = "";

} ######### End of if statement.

&display_print('ste_cat_desc');

} ######### End of if statement.

What do I replace?

Offline

 

#6 08-26-2004 10:47:04

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19850
Website

Re: Calculating Number Of Items In Category

Make the mod as posted, but leave:

Code:


if ($category_active eq "N") {

$category_descsale = "";

} ######### End of if statement.

In there too.


Nick Hendler

Offline

 

Board footer