Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Centering Subcategories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 09-13-2010, 01:39 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Re: Centering Subcategories

Not sure I understand your problem but you have declared that the table has a width of 100%. This makes it impossible for it to be centered. You could try removing the width declaration and just add a center declaration:

Code:
<center><table border="0" cellspacing="5"> ... </tr></table></center><br>
__________________
www.qualitylamps.eu
X-Cart Gold 4.1.8, PHP 5.2.6, MySQL 5.0.51a, Apache 2.2.9

www.vervangjelamp.nl
X-Cart Gold 4.2.0, PHP 5.2.6, MySQL 5.0.37-standard, Apache/2

Sorry for the weird user name, I registered it by mistake
Reply With Quote
  #3  
Old 09-13-2010, 11:59 AM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default Re: Centering Subcategories

I wanted to make the subcategory boxes appear centred within their cells, i.e. if there was only subcategory, it would only have one table cell, and would appear centred in that, if there were two subcategories, they would appear to be spaced equally horizontally, etc. I don't want to centre the entire table itself.
Using the code I added (which I took from the modified version of modules/Recommended_Products/recommends.tpl which I have uploaded to Completed Mods) I wanted to lay out the subcategory images in the same way as you see in the Related Products on the website.
__________________
X-Cart Gold Version 4.3.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:46 PM.

   

 
X-Cart forums © 2001-2020