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 }&cat={ $subproduct.productid }&cat={$cat}&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 :) |
Re: Products under subcategories keeping existing layout
Please Please help
|
Re: Products under subcategories keeping existing layout
So I have the following code that prints out the subcategory the products name, the description but then it only displays the variables and price for the first product under every product instead of displaying the indiviual products variables. when I include the code: {section name=product loop=$products} it displays every products variable under every product. Can someone please help.
{if $subcategories } <table width="100%" > {foreach from=$subcategories item=subcat} <tr> <td class="ColumnTitles" valign="top"> <a href="home.php?cat={ $subcat.categoryid }"> <font class="ItemsList">{ $subcat.category|escape }</font></a> </td> </tr> {foreach from=$subcat.products item=subproduct} <tr> <td class="ColumnTitles" valign="top"> <a href="product.php?productid={$subproduct.productid }&cat={$subproduct.productid }&cat={$cat}&page={$navigation_page}"> {$subproduct.product|escape}</a> </td> </tr> <tr> <td> {$subproduct.descr|truncate:100:"...":true} </td> </tr> {foreach from=$products[product] item=products} {section name=product } </tr> <td> {include file="customer/main/buy_now.tpl" product=$products[product]} </td> </tr> {/section} {/foreach} {/foreach} {/foreach} </table> {/if} |
Re: Products under subcategories keeping existing layout
anybody :(
|
Re: Products under subcategories keeping existing layout
Um... oh.... any help what so ever would be good
|
Re: Products under subcategories keeping existing layout
I'm not sure, but why do you loop through products twice?
Are you sure you need this loop: "{foreach from=$products[product] item=products}"? Don't you do this already here: "{foreach from=$subcat.products item=subproduct}"? |
All times are GMT -8. The time now is 10:26 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.