X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Displaying Option Fields Twice in Product listings (https://forum.x-cart.com/showthread.php?t=23575)

GooseCA 07-25-2006 01:06 PM

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]

balinor 07-25-2006 01:48 PM

Is this a question or a completed modification? Please clearly state what the topic is about. Thank you.

GooseCA 07-25-2006 03:13 PM

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.

balinor 07-25-2006 03:15 PM

I'm not seeing that happen on my end.

GooseCA 07-25-2006 03:17 PM

Ram and Hard Drive both appear twice in the description of the items.

mocara 07-25-2006 05:08 PM

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

GooseCA 07-25-2006 05:46 PM

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?

mocara 07-25-2006 05:57 PM

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.

GooseCA 07-25-2006 06:09 PM

Thanks for your help. I guess does anyone know the code from the standard template to display the option fields of a product?

GooseCA 07-26-2006 10:57 AM

Also, is there a smarty command from which I can figure out with php script declares the sp_option_classes array?


All times are GMT -8. The time now is 02:00 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.