1
qcorek
would i get some support here
  • 2008/1/23 12:08

  • qcorek

  • Just popping in

  • Posts: 68

  • Since: 2007/10/7


Smartsection;

There is a block called Categories Menu block(Menu displaying categoies).


It show all categories which are created. I have few subcategories in each category and i would like to view number of subcategories in this Categories Menu block.

eg. I have a category Audi and few subcategories in it "TT; A6; A8"

I would like to have this "counter" which would show in Categories Menu block that there are 3 subcategories in Audi category

sth lik this....

AUDI (3)


Please help, please;

There is sth like this in smartsection index table there is a row that shows how many subcat are in specyfic cat;

smartsection_categories_table.html;

I'm am PHP lame and have no idea how to implement this function in block

Please you PHP geeks help me

2
kerkyra
Re: would i get some support here
  • 2008/1/23 14:44

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


create a MySQL query in the php file responsible for showing that template.

the query should return the records in the database that have the parent id number same as the id number of the parent categories.

save the count results in an array and pass it to the template via smarty,

edit the template file and next to every category add the parentesis (), and inside the smarty variable that holds the subcategories count results for each category.

Thats only a rough idea on how you can do it! Hope it helps you a bit..
www.guidemap.gr - Beta is out...

3
qcorek
Re: would i get some support here
  • 2008/1/23 15:04

  • qcorek

  • Just popping in

  • Posts: 68

  • Since: 2007/10/7


ouch :P

i think that's the code which shows how many articles are in each category

<{if $displayarticlescount}>
<td valign="middle" class="odd" align="center"><{$subcat.total}></td>
<{/if}>
I tried to add this to Categories Menu block but id did not show anything

4
qcorek
Re: would i get some support here
  • 2008/1/23 15:06

  • qcorek

  • Just popping in

  • Posts: 68

  • Since: 2007/10/7


or maybe ths one?
<{if $displayarticlescount}>
<td valign="middle" class="even" align="center">
<{if $category.total != 0}>
<{$category.total}>
<{/if}>
</td>

5
kerkyra
Re: would i get some support here
  • 2008/1/23 20:42

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


thats the code in the html template, behind that html file hides a php file that prepares all those variables connects to the db etc. in there you have to see if there is a variable holding the number of the subcategories of each category..and the name of it! otherwise if the variables are not passed through the php file to the template it will show you nothing...
www.guidemap.gr - Beta is out...

6
qcorek
Re: would i get some support here
  • 2008/1/24 12:37

  • qcorek

  • Just popping in

  • Posts: 68

  • Since: 2007/10/7


thats what it does

Login

Who's Online

214 user(s) are online (167 user(s) are browsing Support Forums)


Members: 0


Guests: 214


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits