AbanteCart Community

Shopping Cart Operations => Tips and Tricks => Topic started by: zonavirtuala on April 18, 2014, 01:26:54 PM

Title: Category Product Count.
Post by: zonavirtuala 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 
Title: Re: Category Product Count.
Post by: abantecart 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>
Title: Re: Category Product Count.
Post by: zonavirtuala on April 21, 2014, 11:02:38 AM

Thanks !


 ... but in  default & template2 ? Who ?


Thank you,



Title: Re: Category Product Count.
Post by: abantecart 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?
Title: Re: Category Product Count.
Post by: zonavirtuala 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 } ?>
Title: Re: Category Product Count.
Post by: zonavirtuala 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/ ... ??