View Single Post
  #37  
Old 05-22-2009, 08:02 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Displaying products in subcategory on category page

For 4.2.1 (home.php code is the same with one from the post#2)

skin1/customer/main/subcategories_t.tpl:
Code:
{* $Id: subcategories_t.tpl,v 1.6 2008/11/25 15:57:54 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {foreach from=$subcategories item=subcategory} <div class="subcategories" style="min-width: {$subcat_div_width}px; width: {$subcat_div_width}px; height: {$subcat_div_height}px; min-height: {$subcat_div_height}px;"> {if $subcategory.is_icon} <a href="home.php?cat={$subcategory.categoryid}"><img src="{$subcategory.icon_url|amp}" alt="{$subcategory.category|escape}" width="{$subcategory.image_x}" height="{$subcategory.image_y}" /></a> {else} <img src="{$ImagesDir}/spacer.gif" alt="" width="1" height="{$subcat_img_height}" /> {/if} <br /> <a href="home.php?cat={$subcategory.categoryid}">{$subcategory.category|escape}</a><br /> {if $config.Appearance.count_products eq "Y"} {if $subcategory.product_count} {$subcategory.product_count} {$lng.lbl_products|lower} {elseif $subcategory.subcategory_count} {$subcategory.subcategory_count } {$lng.lbl_categories|lower} {/if} {/if} </div> {*mod starts*} {if $s_products[$subcategory.categoryid] ne ''} <ul style="float:left"> {foreach from=$s_products[$subcategory.categoryid] item=sprods} <li>{$sprods.product}</li> {/foreach} </ul> {/if} {*mod ends*} {/foreach} <div class="clearing"></div>


skin1/customer/main/subcategories_list.tpl:
Code:
{* $Id: subcategories_list.tpl,v 1.5 2008/11/05 14:22:39 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} <table cellspacing="0" summary="{$lng.txt_list_of_subcategories|escape}"> <tr> <td> <ul class="subcategories"> {foreach from=$subcategories item=subcat} <li> <a href="home.php?cat={$subcat.categoryid}">{$subcat.category|escape}</a> {if $config.Appearance.count_products eq "Y"} {if $subcat.product_count} ({$subcat.product_count} {$lng.lbl_products}) {elseif $subcat.subcategory_count} ({$subcat.subcategory_count } {$lng.lbl_categories|lower}) {/if} {/if} {*mod starts*} {if $s_products[$subcat.categoryid] ne ''} <ul> {foreach from=$s_products[$subcat.categoryid] item=sprods} <li>{$sprods.product}</li> {/foreach} {/if} </ul> {*mod ends*} </li> {/foreach} </ul> </td> </tr> </table>

this is a basic way to insert products. You may improve layout according to your requirements.
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote