| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Products under subcategories keeping existing layout | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
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
__________________
www.easycoffee.com.au Version 4.1.9 |
|||||||
#2
|
|||||||
|
|||||||
Re: Products under subcategories keeping existing layout
Please Please help
__________________
www.easycoffee.com.au Version 4.1.9 |
|||||||
#3
|
|||||||
|
|||||||
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}
__________________
www.easycoffee.com.au Version 4.1.9 |
|||||||
#4
|
|||||||
|
|||||||
Re: Products under subcategories keeping existing layout
anybody
__________________
www.easycoffee.com.au Version 4.1.9 |
|||||||
#5
|
|||||||
|
|||||||
Re: Products under subcategories keeping existing layout
Um... oh.... any help what so ever would be good
__________________
www.easycoffee.com.au Version 4.1.9 |
|||||||
#6
|
|||||||||
|
|||||||||
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}"?
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|