Page 2 of 2

Re: number of products in brackets next to category?

Posted: Sat Oct 23, 2010 5:55 am
by DannyMacD
virgil wrote:Does someone please know how you can make it like this for v1.4.9.1:

Category_A (14)
Subcategory_A (3)
Subcategory_B (5)
Subcategory_C (6)

good to know if this works.

Re: number of products in brackets next to category?

Posted: Tue Jan 24, 2012 3:12 am
by NoJoke
[quote="pepiw"]Hi,
this is the code modified for v1.4.4. Tested and work.

Code: Select all

$this->load->model('catalog/product');
                          $getTotal = '('. $this->model_catalog_product->getTotalProductsByCategoryId($result['category_id']) .')';
                 if ($this->category_id == $result['category_id']) {
                          $output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '"><b>' . $result['name'] . '</b></a>'. $getTotal;
                 } else {
                         $output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '">' . $result['name'] . '</a>' . $getTotal;
                 }
That code works for version 1.4.9.6.

Here is what I did to get the colors

For it to appear like :

Category (0)

I put this code in my style sheet

Code: Select all

#category ul {
    color: red;} 
or if you can find category ul in your style sheet you can add color to it.

For the subcategories :

Code: Select all

#category ul ul {color: purple;}

so the end result would be

Category (0)
Subcategory (8)

Hope it helps