X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Is there a way to count # of subcategories of category id? (https://forum.x-cart.com/showthread.php?t=29774)

pdheady 03-18-2007 06:35 PM

Is there a way to count # of subcategories of category id?
 
I need to display how many subcategories belong to a category id. { $subcat.subcategory_count } should work and it's not.



{if $cat eq "655"}
<div class="bodytext1">There are <span style="color: #128B94; font-weight: bold">
{ $subcat.subcategory_count }
</span> styles to choose from.</div>
<br>
{/if}


pdheady 03-18-2007 08:49 PM

Re: Is there a way to count # of subcategories of category id?
 
For example I click on category A and I get 4 categories as below.

Category A
subcat 1
subcat 2
subcat 3
subcat 4

Now i just want the total subcat 1-4. So the subcat total = 4.

I need that value displayed on my page somehow and i've looked everywhere for it. The { $subcat.subcategory_count } will only total what's below the subcategories (ie. subcat1 = 0, subcat2 =0, etc). I want the total count of the subcat results.

pdheady 03-19-2007 08:02 AM

Re: Is there a way to count # of subcategories of category id?
 
I found this code in /include/categories.php

I wonder if I can do something with this?

Quote:

#
# Count the subcategories
#
$category["subcategory_count"] = func_query_first_cell("SELECT subcategory_count FROM $sql_tbl[categories_subcount] WHERE categoryid='$cat'".($current_area == 'C'?" AND membership = '".addslashes($user_account["membership"])."'":""));

return $category;
}



All times are GMT -8. The time now is 11:25 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.