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

Variants as table

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-08-2010, 08:09 PM
 
masada3336 masada3336 is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 115
 

Default Variants as table

Hi there all,
I'm trying to get my store working in the 4.4 version (haven't updated my signature - this is still a work in progress). I saw a thread that worked in a previous version to show the variants as a static table above the product details. I'm using the following code and getting basically a blank table - is it a simple syntax issue? This is editing the product_details.tpl and came from this thread: http://forum.x-cart.com/showthread.php?t=14705&highlight=show+all+variants +at+once

Thanks!

Code:
{* Determine if product has variants *} {if $variants} <table cellspacing="1" cellpadding="0" border="0" class="chart" width="100%"> {* Build table header *} <tr class="chart_head"> <td>SKU</td> {* Loop to handle multiple variant names *} {foreach from=$product_options item=v} {if $v.is_modifier eq ''}<TD>{if $usertype eq "A"}{$v.class}{else}{$v.classtext|default:$v.class}{/if}</TD>{/if} {/foreach} <td>Qty.</td> <td>Price</td> </tr> {* Build table rows *} {section name=test loop=$variants} <tr class="{cycle values="chart_dark,chart_light"}"> <td>{$variants[test].productcode}</td> {* Loop to handle multiple variants *} {foreach name=foo item=item key=key from=$variants[test].options} <td>{$item.option_name}</td> {/foreach} <td>{if $JIT eq "yes"}Unlimited{else}{if $variants[test].avail < 1}0{else}{$variants[test].avail}{/if}{/if}</td> <td>${$variants[test].price}</td> </tr> {/section} </table> {/if}
__________________
4.4.5 - with Customized Smart Template
Reply With Quote
  #2  
Old 12-05-2010, 03:46 PM
 
masada3336 masada3336 is offline
 

Senior Member
  
Join Date: Jan 2009
Posts: 115
 

Default Re: Variants as table

Thought i'd post my solution for 4.4.1:

This is the product variant table as I have it setup thanks to some direction from the board:

Code:
{* Determine if product has variants *} {if $variants} <table class=inlineSpec width="100%"> {* Build table header *} <tr class="specHeader"> {* Loop to handle multiple variant names *} {foreach from=$product_options item=v} {if $v.is_modifier eq ''}<TD>{if $usertype eq "A"}{$v.class}{else}{$v.classtext|default:$v.class}{/if}</TD>{/if} {/foreach} <td >{$lng.lbl_price}</td> </tr> {* Build table rows *} {foreach item=variant from=$variants} {assign var=exception value="0"} {foreach key=ExceptionKey item=exceptionList from=$product_options_ex} {assign var=found value=0} {assign var=total value=0} {foreach item=classException from=$exceptionList} {math assign=total equation="x + 1" x=$total} {foreach name=l1 item=variantOpt from=$variant.options} {if $variantOpt.optionid eq $classException.optionid}{math assign=found equation="x + 1" x=$found}{/if} {/foreach} {/foreach} {if $found eq $total}{assign var=exception value="1"}{/if} {/foreach} {if $exception ne "1"} <tr class="specItemHeader{cycle values="1,2"}"> {* Loop to handle multiple variants *} {foreach name=foo item=variantOpt key=key from=$product_options} {if $variantOpt.is_modifier eq ''} <TD> {foreach name=bar item=varOpt from=$variant.options} {if $varOpt.classid == $variantOpt.classid}{$varOpt.option_name}{/if} {/foreach} </TD> {/if} {/foreach} <td>{include file="currency.tpl" value=$variant.price}</td> </tr> {/if} {/foreach} </table> {/if}
__________________
4.4.5 - with Customized Smart Template
Reply With Quote
  #3  
Old 01-05-2011, 05:38 AM
  mizNRG's Avatar 
mizNRG mizNRG is offline
 

Senior Member
  
Join Date: Jun 2010
Posts: 157
 

Default Re: Variants as table

I attempted to apply this code and it is causing all of my product descriptions to repeat. Once at the top (above Details and buttons) and once below. This is occuring on all of my products and not just the one with product variants. Any ideas as to why this is happening?
__________________
X-Cart 4.4.4 Gold
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 01:06 AM.

   

 
X-Cart forums © 2001-2020