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

Displaying Option Fields Twice in Product listings

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-25-2006, 01:06 PM
 
GooseCA GooseCA is offline
 

Newbie
  
Join Date: Jul 2006
Posts: 9
 

Default Displaying Option Fields Twice in Product listings

Here is the code for the product listing thing.

Code:
<tr> <td> <table border="0" width="500" cellspacing="0" cellpadding="0" class="title-{if $cat eq 249}amd{elseif $cat eq 254}intel{elseif $cat eq 258}unmetered{/if}"> <tr> <td width="356" class="title-{if $cat eq 249}amd{elseif $cat eq 254}intel{elseif $cat eq 258}unmetered{/if}server"> {$product.product}</td> <td width="142" style="padding:0px;">[img]{$ImagesDir}/logo-{if $cat eq 249}amd{elseif $cat eq 254}intel{elseif $cat eq 258}unmetered{/if}.gif[/img]</td> </tr> </table> </td> </tr> <tr> <td class="specs-bg"> <table border="0" width="496" cellpadding="0"> <tr> <td width="300"> {assign var="price" value=$product.taxed_price} {assign var="monthly_price" value=$product.list_monthly_price} {if $active_modules.Product_Options ne "" and $sp_option_classes ne ""} {assign var="tmp" value="1"} {foreach name=classes item=class from=$sp_option_classes} {if $product.product_options[$class.class].option_name ne ""} <span class="specs-{if $tmp is div by 2}2{else}1{/if}">[img]{$ImagesDir}/arrow1.gif[/img]{$class.class}: {$product.product_options[$class.class].option_name}</span> {assign var="tmp" value=$tmp+1} {/if} {if $product.product_options[$class.class].price_modifier ne 0} {if $product.product_options[$class.class].modifier_type ne "%"} {math equation="x + y" x=$price y=$product.product_options[$class.class].price_modifier assign="price"} {else} {math equation="x + y*z/100" x=$price z=$product.taxed_price y=$product.product_options[$class.class].price_modifier assign="price"} {/if} {/if} {if $product.product_options[$class.class].monthly_price_modifier ne 0} {if $product.product_options[$class.class].monthly_modifier_type ne "%"} {math equation="x + y" x=$monthly_price y=$product.product_options[$class.class].monthly_price_modifier assign="monthly_price"} {else} {math equation="x + y*z/100" x=$monthly_price z=$product.list_monthly_price y=$product.product_options[$class.class].monthly_price_modifier assign="monthly_price"} {/if} {/if} {/foreach} {/if} </td> <td width="196" align="center"> <span class="price02"> {if $monthly_price}<font color="#B8143D">{include file="currency.tpl" value=$monthly_price}</font> monthly</span> {else}{/if} {if $price}<span class="price03">setup fee: {include file="currency.tpl" value=$price}</span> {else}{/if} {if $config.General.unlimited_products ne "Y" and ($product.avail le 0 or $product.avail lt $product.min_amount)} [img]{$ImagesDir}/btn-customize.gif[/img] {else} [img]{$ImagesDir}/btn-customize.gif[/img] {/if} </td> </tr> </table> </td> </tr>
[/code]
__________________
Version 4.0.9
Reply With Quote
  #2  
Old 07-25-2006, 01:48 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Is this a question or a completed modification? Please clearly state what the topic is about. Thank you.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 07-25-2006, 03:13 PM
 
GooseCA GooseCA is offline
 

Newbie
  
Join Date: Jul 2006
Posts: 9
 

Default

Sorry, it's a question. For some reason, the option fields appear twice as can be viewed at www.intercage.com/site/xcart/home.php?cat=249 rather than once. I don't know why it's doing that; the code above only calls the option fields once so the problem is rather peculiar. Any help is appreciated.
__________________
Version 4.0.9
Reply With Quote
  #4  
Old 07-25-2006, 03:15 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

I'm not seeing that happen on my end.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 07-25-2006, 03:17 PM
 
GooseCA GooseCA is offline
 

Newbie
  
Join Date: Jul 2006
Posts: 9
 

Default

Ram and Hard Drive both appear twice in the description of the items.
__________________
Version 4.0.9
Reply With Quote
  #6  
Old 07-25-2006, 05:08 PM
 
mocara mocara is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 55
 

Default

Hi,
The problem appears to be your foreach loop is being looped more than once but only for the first two items (obvious I know). So the question is what is causing that? Where is $sp_option_classes from? A quick grep -R sp_option_classes * in my codebase says I don't have that variable.

Mocara
__________________
4.0.15
Linux
Reply With Quote
  #7  
Old 07-25-2006, 05:46 PM
 
GooseCA GooseCA is offline
 

Newbie
  
Join Date: Jul 2006
Posts: 9
 

Default

I'm editing this template from a pre-made template that had a similar code. I don't know much about x-cart, but I assumed $sp_option_classes came standard. Is there any other way to access your option's fields?
__________________
Version 4.0.9
Reply With Quote
  #8  
Old 07-25-2006, 05:57 PM
 
mocara mocara is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 55
 

Default

I think if you are using non-standard templates, then it would really mean looking at all the code. Sorry I couldn't be more help.

Mocara.
__________________
4.0.15
Linux
Reply With Quote
  #9  
Old 07-25-2006, 06:09 PM
 
GooseCA GooseCA is offline
 

Newbie
  
Join Date: Jul 2006
Posts: 9
 

Default

Thanks for your help. I guess does anyone know the code from the standard template to display the option fields of a product?
__________________
Version 4.0.9
Reply With Quote
  #10  
Old 07-26-2006, 10:57 AM
 
GooseCA GooseCA is offline
 

Newbie
  
Join Date: Jul 2006
Posts: 9
 

Default

Also, is there a smarty command from which I can figure out with php script declares the sp_option_classes array?
__________________
Version 4.0.9
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 02:37 PM.

   

 
X-Cart forums © 2001-2020