Jump to content

[SOLVED] How can I display total number of products per category and subcategory


Recommended Posts

Hello,

I am using PS 1.5.4.1 default theme, and I am trying to add "Found xxx Results" in the "content_sortPagiBar" section of the category and subcategory pages.

 

I have tried the solution propsed here. But it did not work for me. Instead of getting the number of prodcuts in my current category, I get '6', which probably corresponds to one of the nested subcategories which has 6 products.

 

Any idea on how I can acheive this?

 

(on a similar topic, any idea how to get the number of subcategories displayed, if any)

 

Thank you

Edited by kingsinnersoul (see edit history)
Link to comment
Share on other sites

Answering my own question:

I used the following code in categories.tpl and price-drop.tpl

<p style="margin-left:10px">
    {if $stop == $start && $stop == $pages_nb} <!-- SINGLE PAGE -->
	 {l s='Showing %d products' sprintf=$nb_products}
    {elseif $p == $pages_nb} <!-- LAST PAGE -->
	 {l s='Showing %d ' sprintf=( ($p-1)*$products_per_page+1 ) }
	 {' - '} {$nb_products}
	 {l s=' out of %d products' sprintf=( $nb_products ) }
    {else} <!-- ANY OTHER PAGE (FIRST OR MIDDLE) -->
	 {l s='Showing %d ' sprintf=( ($p-1)*$products_per_page+1 ) }
	 {' - '} {$p*$products_per_page}
	 {l s=' out of %d products' sprintf=( $nb_products ) }
    {/if}
   </p>

Edited by kingsinnersoul (see edit history)
Link to comment
Share on other sites

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...