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

Products under subcategories keeping existing layout

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 02-15-2008, 02:54 AM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Default Re: Products under subcategories keeping existing layout

Please Please help
__________________
www.easycoffee.com.au
Version 4.1.9
Reply With Quote
  #3  
Old 02-15-2008, 02:29 PM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Default 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 }&amp;cat={$subproduct.productid }&amp;cat={$cat}&amp;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
Reply With Quote
  #4  
Old 02-16-2008, 07:50 PM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Unhappy Re: Products under subcategories keeping existing layout

anybody
__________________
www.easycoffee.com.au
Version 4.1.9
Reply With Quote
  #5  
Old 02-17-2008, 02:04 AM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Default 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
Reply With Quote
  #6  
Old 04-25-2016, 09:26 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:40 AM.

   

 
X-Cart forums © 2001-2020