Author Topic: Category Product Count.  (Read 5016 times)

Offline zonavirtuala

  • Newbie
  • *
  • Posts: 19
  • Karma: +2/-0
    • View Profile
Category Product Count.
« on: April 18, 2014, 01:26:54 PM »

Category Product Count... similar OpenCart.  How?

(Show the number of products inside the subcategories in the storefront header category menu)

View example 

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 3972
  • Karma: +243/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Category Product Count.
« Reply #1 on: April 20, 2014, 07:43:39 PM »
This is just a matter of adding
Code: [Select]
<?php echo $category['product_count']?> in the template for category.

Locate this file: storefront/view/default_html5/template/blocks/category.tpl

Replace:
Code: [Select]
<a class="productname" href="<?php echo $item['info_url'?>"><?php echo $item['name']?></a>with:
Code: [Select]
<a class="productname" href="<?php echo $item['info_url'?>"><?php echo $item['name']?> (<?php echo $category['product_count']?>)</a>
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline zonavirtuala

  • Newbie
  • *
  • Posts: 19
  • Karma: +2/-0
    • View Profile
Re: Category Product Count.
« Reply #2 on: April 21, 2014, 11:02:38 AM »

Thanks !


 ... but in  default & template2 ? Who ?


Thank you,



« Last Edit: April 23, 2014, 09:43:01 AM by zonavirtuala »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 3972
  • Karma: +243/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Category Product Count.
« Reply #3 on: April 21, 2014, 11:31:49 AM »
... but in  default & tamplate2 ? Who ?
This will be similar in other templates. What do you mean by who?
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline zonavirtuala

  • Newbie
  • *
  • Posts: 19
  • Karma: +2/-0
    • View Profile
Re: Category Product Count.
« Reply #4 on: April 23, 2014, 09:48:38 AM »
not work ...:(

in default...  not found code " <a class="productname" href="<?php echo $item['info_url'] ?>"><?php echo $item['name']?></a>  " .




storefront/view/default/template/block/category.tpl

in default, code is:

<?php if ( $block_framed ) { ?>
<div class="s_block">
   <div class="block_tl">
      <div class="block_tr">
         <div class="block_tc"><img src="<?php echo $this->templateResource('/image/category.png'); ?>" alt="" /><?php echo $heading_title; ?></div>
      </div>
   </div>
    <div class="block_cl">
       <div class="block_cr">
           <div class="block_cc">
<?php } ?>
               <div class="category_list">
                  <ul>
                  <?php
                  foreach($category_list as $item){
                     $cname = $item['category_id']==$selected_category_id ? '<b>'.$item['name'].'</b>' : $item['name'];
                  echo '<li>'.str_repeat('&nbsp;&nbsp;&nbsp;',$item['level']).'<a href="'.$item['href'].'">'.$cname.'</a></li>';
                  }?>
               </ul>
               </div>
<?php if ( $block_framed ) { ?>
            </div>
        </div>
    </div>
   <div class="block_bl">
      <div class="block_br">
         <div class="block_bc">&nbsp;</div>
      </div>
   </div>
</div>
<?php } ?>
« Last Edit: April 23, 2014, 09:54:54 AM by zonavirtuala »

Offline zonavirtuala

  • Newbie
  • *
  • Posts: 19
  • Karma: +2/-0
    • View Profile
Re: Category Product Count.
« Reply #5 on: April 23, 2014, 10:07:43 AM »




in template 2, not found ... category.tpl


in template 2 :
 
extensions/template2/storefront/view/template2/template/blocks/ ... ??