View Single Post
  #1  
Old 09-12-2010, 06:01 AM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default Centering Subcategories

Hi, I've been trying to center the Subcategories that are on this site which I am working on:

http://88.208.205.21/home.php?shopkey=martin
and then go to:
http://88.208.205.21/home.php?cat=253

for an example.

I edited customer/main/subcategories_t.tpl as follows (the added parts are in red):

Code:
{* $Id: subcategories_t.tpl,v 1.7.2.2 2009/12/07 12:58:11 aim Exp $ vim: set ts=2 sw=2 sts=2 et: *} {section name=subcat_num loop=$subcategories} { if %subcat_num.first% } <table border="0" cellspacing="5" width="100%"> {/if} {if $smarty.section.subcat_num.index is div by 3} </tr><tr valign="top"> {/if} <td align="center"> {foreach from=$subcategories item=subcategory} <span class="subcategories" style="min-width: {$subcat_div_width+2}px; width: {$subcat_div_width}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} <p><a class="subcat_desc" href="home.php?cat={$subcategory.categoryid}">{$subcategory.category|escape}</a></p> {if $config.Appearance.count_products eq "Y"} {if $subcategory.product_count}{$subcategory.product_count}&nbsp;{$lng.lbl_product}{if $subcategory.product_count > 1}s{/if}{/if} {elseif $subcategory.subcategory_count} {$subcategory.subcategory_count}{if $subcategory.subcategory_count = 1}{$lng.lbl_subcategory}{elseif $subcategory.subcategory_count > 1}{$lng.lbl_subcategories}{/if} {/if} </span> {/foreach} </td> { if %subcat_num.last% } </tr></table><br> {/if} {/section} <div class="clearing"></div> <br />

All the code in black is the original code.
The code I have added makes the page display the subcategories twice if there are two, or three times if there are three, etc.
I know that it needs to display all the subcategories, and I presume it comes from this code:
{foreach from=$subcategories item=subcategory}

but can anybody help me to fix this? All I want was to centre the subcategories, so that they appear like the related products, for example:

http://88.208.205.21/product.php?productid=17514&cat=262&page=1
__________________
X-Cart Gold Version 4.3.2
Reply With Quote