View Single Post
  #1  
Old 07-11-2007, 08:16 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Categories in Columns on Front Page v4.x

1) Create a new file according to your version, either...

cats_in_cols_v40x.tpl

or...

cats_in_cols_v41x.tpl

2) Add the code below according to your version...

Code for v4.0.x

Code:
{* -------------------------------------- *} {* Categories in Columns with Icons on Front Page - v4.0.x *} {* Set the number of columns ------------ *} {assign var='cols' value='4'} {* -------------------------------------- *} {capture name=dialog} {section name=cat_num loop=$subcategories} {if %cat_num.first%} <table width="100%" border="0" cellpadding="5" cellspacing="0"> {/if} {if %cat_num.index% is div by $cols} <tr> {/if} <td width="{math equation="100 / x" x=$cols}%" align="center" valign="top"> <a href="home.php?cat={$subcategories[cat_num].categoryid}"> <img src="{$xcart_web_dir}/icon.php?categoryid={$subcategories[cat_num].categoryid}" border="0" alt="{$subcategories[cat_num].category|escape}"> </a> <br /> <a href="home.php?cat={$subcategories[cat_num].categoryid}"><b>{$subcategories[cat_num].category|escape}</b></a> {if $config.Appearance.count_products eq "Y"} {if $subcategories[cat_num].product_count} <br /> {$subcategories[cat_num].product_count} {$lng.lbl_items} {/if} {if $subcategories[cat_num].subcategory_count} <br /> {$subcategories[cat_num].subcategory_count} {$lng.lbl_subcategories} {/if} {/if} </td> {if %cat_num.last%} </tr> </table> {/if} {/section} {/capture} {include file="dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.dialog extra="width=100%"}

Code for v4.1.x

Code:
{* -------------------------------------- *} {* Categories in Columns with Icons on Front Page - v4.1.x *} {* Set the number of columns ------------ *} {assign var='cols' value='4'} {* -------------------------------------- *} {capture name=dialog} {foreach from=$categories item=c name=cats} {if $smarty.foreach.cats.first} <table width="100%" border="0" cellpadding="5" cellspacing="0"> {/if} {if $smarty.foreach.cats.index is div by $cols} <tr> {/if} <td width="{math equation="100 / x" x=$cols}%" align="center" valign="top"> <a href="home.php?cat={$c.categoryid}"> <img src="{$xcart_web_dir}/image.php?id={$c.categoryid}&amp;type=C" border="0" alt="{$c.category}"> </a> <br /> <a href="home.php?cat={$c.categoryid}"><b>{$c.category}</b></a> {if $config.Appearance.count_products eq "Y"} {if $c.product_count} <br /> {$c.product_count} {$lng.lbl_items} {/if} {if $c.subcategory_count} <br /> {$c.subcategory_count} {$lng.lbl_subcategories} {/if} {/if} </td> {if $smarty.foreach.cats.last} </tr> </table> {/if} {/foreach} {/capture} {include file="dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.dialog extra="width=100%"}

3) Upload the new file created to skin1/customer/main/

4) Then in...

skin1/customer/main/welcome.tpl

Add..

Code:
{include file="customer/main/cats_in_cols_v40x.tpl"}

or...

Code:
{include file="customer/main/cats_in_cols_v41x.tpl"}

Done
__________________
xcartmods.co.uk
Reply With Quote