View Single Post
  #1  
Old 02-13-2008, 02:46 PM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Default Products under subcategories keeping existing layout

I know it is possible to sort products by subcategories:
Subcategory 1
Product 1
Product 2
Subcategory 2
Product 1
Product 2
Product 3
Product 4

Buy using this code http://forum.x-cart.com/showthread.php?t=19730
However this code changes the whole layout of the products.
I want to know if there is a way to keep the existing individual products layout but change the over all layout to be like this
Subcategory 1
Product 1
Product 2
Subcategory 2
Product 1
Product 2
Product 3
Product 4

I think it has something to do with this part of the code from <table> to </table> in the skin1/customer/main/subcategories.tpl

<table cellspacing="5" width="100%" border="2">
{foreach from=$subcategories item=subcat}
<tr>
<td class="ColumnTitles" valign="top"><a title="{$subcat.description}" <a href="home.php?cat={ $subcat.categoryid }"><img src="{if $subcat.icon_url}{$subcat.icon_url}{else}{$xcart_w eb_dir}/default_image.gif{/if}" alt="" /><br>
<font class="ItemsList">{ $subcat.category|escape }</font></a>
</td></tr>
{foreach from=$subcat.products item=subproduct}
{if $tmp is div by 3}
<tr><td colspan="3"></td></tr>
<tr valign="top">
{/if}
{ if $tmp and $first_subproduct ne "Y" }
{assign var="tmp" value=0}
{assign var="first_subproduct" value="Y"}
{/if}
{if subproduct}
<td class="ColumnTitles" valign="top"><a title="{$subproduct.description}" <a href="product.php?productid={$subproduct.productid }&amp;cat={ $subproduct.productid }&amp;cat={$cat}&amp;page={$navigation_page}"><img src="{if $subproduct.tmbn_url}{$subproduct.tmbn_url}{else}{ $xcart_web_dir}/default_image.gif{/if}" alt="" /><br>
{$subproduct.product|escape}
{/if}
<br>
{assign var="tmp" value=$tmp+1}
{/foreach}
{if $tmp is not div by 3}
{assign var="tmp" value=3}
{/if}
{/foreach}
</tr>
</td>
</table>Cheers in advance
__________________
www.easycoffee.com.au
Version 4.1.9
Reply With Quote