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

Subcategory Rows Not Filled Properly

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-15-2008, 02:17 PM
 
anela2003 anela2003 is offline
 

Senior Member
  
Join Date: Nov 2007
Posts: 103
 

Talking Subcategory Rows Not Filled Properly

I have a question about proper formatting for my subcategory rows. I have used previous posts on this topic (although quite difficult to apply because they are old) to alter my subcategory templates. This was in January I believe.

Well, now that I have 10 subcategories within a subcategory itself, they are not displayed properly. Initially, I set up the layout to show 5 subcategories per row. But now, it shows 5 in row 1, 4 in row 2 and 1 in row 3 (instead of filling a row before starting a new one).

I'm guessing that it has to do with the "$tmp" in my subcategories.tpl, but I haven't been able to change it to what I want it to do.

Here's the problem page that doesn't fill the rows completely:

Custom Valances



And here's my subcategories.tpl:
HTML Code:
{* $Id: subcategories.tpl,v 1.43.2.9 2006/06/27 08:22:01 svowl Exp $ *} {if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description}<BR><BR>{/if} {capture name=dialog} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} {if $subcategories} <table class="sublisttable"> <tr> {foreach from=$subcategories item=subcat} {if $tmp is div by 4} </tr> <tr class="sublisttr"> {/if} { if $tmp and $first_subcat ne "Y" } {assign var="tmp" value=0} {assign var="first_subcat" value="Y"} {/if} <td class="subclist"> <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}" alt="Priority Windows Custom Products" width="150" height="150"><br> <font class="ItemsList">{ $subcat.category|escape }</font><BR><img src="images/customize.png" width="150" height="25"></a>{if $config.Appearance.count_products eq "Y"}{/if} {assign var="tmp" value=$tmp+1} {/foreach} </table> {/if} {if $tmp and $products ne "" } <BR clear="left"> <HR size="1" noshade> {/if} {if $products} {if $sort_fields} <DIV align="right">{include file="main/search_sort_by.tpl" sort_fields=$sort_fields selected=$search_prefilled.sort_field direction=$search_prefilled.sort_direction url="home.php?cat=`$cat`&"}</DIV> {/if} {if $total_pages gt 2} <BR> { include file="customer/main/navigation.tpl" } {/if} <BR> {include file="customer/main/products.tpl" products=$products} {/if} {if $products eq "" and $tmp eq "0"} {$lng.txt_no_products_in_cat} {/if} {/capture} {include file="dialog.tpl" title=$current_category.category content=$smarty.capture.dialog extra="width=100%"} {if $products eq ""} {if $f_products ne ""} <P> {include file="customer/main/featured.tpl"} {/if} {/if} { include file="customer/main/navigation.tpl" }



Thanks again!!!
__________________
4.1.9 Gold

window valances | curtains
Reply With Quote
  #2  
Old 04-15-2008, 03:51 PM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: Subcategory Rows Not Filled Properly

Hi anela2003,

What about trying this below. Adapt where you see fit (I've removed a quite a bit of code as we're concentrating on the table itself and made it html valid in the process)...

Code:
{if $subcategories} {assign var="items_per_row" value=5} <table class="sublisttable"> <tr class="sublisttr"> {foreach from=$subcategories item=subcat name=loopy} <td class="subclist"> <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_web_dir}/default_image.gif{/if}" alt="Priority Windows Custom Products" width="150" height="150" /><br /> <span class="ItemsList">{ $subcat.category|escape }</span><br /><img src="images/customize.png" width="150" height="25" alt="" /></a> </td> {if $smarty.foreach.loopy.iteration mod $items_per_row eq 0} </tr><tr class="sublisttr"> {/if} {/foreach} </tr> </table> {/if}

Hope this gets in you in the right direction.
__________________
Doms
kube v4.1.9
Reply With Quote
  #3  
Old 04-15-2008, 11:33 PM
 
anela2003 anela2003 is offline
 

Senior Member
  
Join Date: Nov 2007
Posts: 103
 

Default Re: Subcategory Rows Not Filled Properly

BEAUTIFUL!

Worked like a charm, thank you, thank you.
__________________
4.1.9 Gold

window valances | curtains
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 12:09 PM.

   

 
X-Cart forums © 2001-2020