Php 将值设置回£;0.00,如果选择菜单返回选择
我有一个选择价格选项的下拉菜单。默认选项是select,一旦选择了一个选项,我就会更新总价以反映选项的价格。这样就行了,但如果你再回去选择“选择”,我的总价值中会有“未定义”的 这是密码 加价Php 将值设置回£;0.00,如果选择菜单返回选择,php,javascript,Php,Javascript,我有一个选择价格选项的下拉菜单。默认选项是select,一旦选择了一个选项,我就会更新总价以反映选项的价格。这样就行了,但如果你再回去选择“选择”,我的总价值中会有“未定义”的 这是密码 加价 <form class="optionsForm" name="form{$option.optionID}" action="/view-cart.html" enctype="multipart/form-data" method="post" > <inp
<form class="optionsForm" name="form{$option.optionID}" action="/view-cart.html" enctype="multipart/form-data" method="post" >
<input type="hidden" value="{$option.optionPrice}" name="productPrice" id="optionPrice" />
<input type="hidden" value="{$product.productID}" name="instanceID" />
<input type="hidden" value="add" name="action"/>
<input type="hidden" value="products" name="componentID"/>
<input type="hidden" value="{$option.optionID}" name="options[optionID]" id="optionID"/>
<input type="hidden" value="add" name="action"/>
{* If there is only one option, don't show the select option row *}
{if count($product.productOptions) > 1}
<h4 class="optionsFormTitle">Please select your options</h4>
<div class="optionsRow">
<select name="options" class="dropDown">
<option value="0.00">Select</option>
{foreach $product.productOptions option}
<option value="{$option.optionID}">{$option.optionTitle}
{if $option.optionPrice > $product.pricesFrom} £{$option.optionPrice}{/if}
</option>
{/foreach}
</select>
</div>
{/if}
<div {if count($product.productOptions) > 1} class="totalRow" {else} class="noOptionTotalRow" {/if} >
Total<span class="productPrice optionPrice"> £0.00</span>
<input type="submit" value="Add To Basket" class="buyNowButton" />
</div>
</form>
也许您应该先将默认价格添加到
产品中。价格数组
products.prices = new Array;
products.prices["0.00"] = "0.00";
你确定它是在产品价格中定义的吗?
products.prices = new Array;
products.prices["0.00"] = "0.00";