Jump to content

Remove or change product count on (sub) categories in P1.6


uddhava

Recommended Posts

I was looking for an easy way to remove the product count on (sub) categories in PS1.6. There were some forum posts available that discussed this, but they deal with modules.

The current product count on categories is handled by the category.tpl and category-count.tpl in the theme's root folder.

 

Option one - Remove count completely

 

Edit /themes/YOURTHEME/category.tpl line 73 :

 

Old code

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span>{include file="$tpl_dir./category-count.tpl"}</h1>

New Code

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}"><span class="cat-name">{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}</span></h1>

Option 2 - Remove count but keep message "There are no products in this category"

 

Edit /themes/YOURTHEME/category-count.tpl - line 30

 

Old Code

{else}
{if $nb_products == 1}
{l s='There is %d product.' sprintf=$nb_products}
{else}
{l s='There are %d products.' sprintf=$nb_products}
{/if}

 

New Code

{* {else}
{if $nb_products == 1}
{l s='There is %d product.' sprintf=$nb_products}
{else}
{l s='There are %d products.' sprintf=$nb_products}
{/if}
*}

I just commented out the ELSE clause with {* *} so this part will not run during execution.

You could also delete the code entirely but i left it in for comparison.

 

 

Option 3 - Hide product count

 

You could also just hide the category count using CSS. 

 

Edit the global.css (around line 6169)

Find this code:

.page-heading span.heading-counter {
font: bold 13px/22px Arial, Helvetica, sans-serif;
float: right;
color: #333333;
text-transform: none;
margin-bottom: 10px;
}

Replace it with this :

page-heading span.heading-counter {
display:none;
}
Edited by uddhava (see edit history)
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...