Sidebar

startup_tutorial_and_checklist:design_configuration:smarty_template_code_extensions:display_subcategory_counts

Displaying Subcategory Counts on Front Page

There is admin tool control to make the category counts display within the front page but not for the subcategories displayed within the admin tool. The default display is:

But it is a simple change within a system template to get them to display like this:

Look to make a change within the following system template:

/geo_templates/[your template set - not default]/system/browsing/common/category_block.tpl

And as always follow these guidelines when making system/module template changes as the /default template set is over written in an update:

http://geodesicsolutions.com/support/geocore-wiki/doku.php/id,tutorials;design_adv;replace_system_templates/

Please read the above link. It explains why that template does not exist in your custom template set and how to to get it there so you can make changes to it.

Look for this code in that file:

									{foreach from=$cat.sub_categories item=sub_cat}
										<li class="element subcategory_{$sub_cat.category_id}">
											<a href="{$link}{$sub_cat.category_id}">
												<span class="category_title">
													{$sub_cat.category_name|fromDB}
												</span>
											</a>
										</li>
									{/foreach}

and change to:

									{foreach from=$cat.sub_categories item=sub_cat}
										<li class="element subcategory_{$sub_cat.category_id}">
											<a href="{$link}{$sub_cat.category_id}">
												<span class="category_title">
													{$sub_cat.category_name|fromDB}
													<span class="listing_counts">({$sub_cat.category_count})({$sub_cat.auction_category_count})</span>
												</span>
											</a>
										</li>
									{/foreach}

Note that you are only adding the one line but that line could be many different ways to suit your needs. This displays them all the time:

<span class="listing_counts">({$sub_cat.category_count})({$sub_cat.auction_category_count})</span>

While this only displays when a count is there:

{if $sub_cat.category_count}<span class="listing_counts">({$sub_cat.category_count})({$sub_cat.auction_category_count})</span>{/if}

You can put whatever css you want to use in there also. The choices are yours.

<tip c n>Note that since this is a template level change you can turn off the display of the main category counts within the admin tool and just have the subcategory counts display through this system template change. You can turn off the main category count display here in the admin tool:

SITE SETUP > BROWSING SETTINGS > Display Category/Subcategory Counts

</tip>

startup_tutorial_and_checklist/design_configuration/smarty_template_code_extensions/display_subcategory_counts.txt · Last modified: 2014/09/25 16:55 (external edit)