我在Virtuemart 3购物车中有一个奇怪的行为,我想了解并解决。
关于以下代码:
<input type="text"
onblur="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
onclick="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
onchange="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
onsubmit="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
title="<?php echo vmText::_('COM_VIRTUEMART_CART_UPDATE') ?>" class="quantity-input js-recalculate" size="3" maxlength="4" name="quantity[<?php echo $pkey; ?>]" value="<?php echo $prow->quantity ?>" />
<button type="submit" class="vmicon vm2-add_quantity_cart sprite" name="updatecart.<?php echo $pkey ?>" title="<?php echo vmText::_ ('COM_VIRTUEMART_CART_UPDATE') ?>" ></button>
<button type="submit" class="vmicon vm2-remove_from_cart" name="delete.<?php echo $pkey ?>" title="<?php echo vmText::_ ('COM_VIRTUEMART_CART_DELETE') ?>" ><span class="delBut">x</span><?php echo vmText::_ ('COM_VIRTUEMART_CART_DELETE') ?></button>
当有人在文本字段中输入不同的金额并点击&#34;输入&#34; /&#34;返回&#34;产品数量更新完全没问题。但是,如果我按照以下代码切换两个按钮,并且客户点击&#34;输入&#34; /&#34;返回&#34;金额已更新,但顶级产品也会从购物车中删除。
<input type="text"
onblur="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
onclick="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
onchange="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
onsubmit="Virtuemart.checkQuantity(this,<?php echo $step?>,'<?php echo vmText::_ ('COM_VIRTUEMART_WRONG_AMOUNT_ADDED',true)?>');"
title="<?php echo vmText::_('COM_VIRTUEMART_CART_UPDATE') ?>" class="quantity-input js-recalculate" size="3" maxlength="4" name="quantity[<?php echo $pkey; ?>]" value="<?php echo $prow->quantity ?>" />
<button type="submit" class="vmicon vm2-remove_from_cart" name="delete.<?php echo $pkey ?>" title="<?php echo vmText::_ ('COM_VIRTUEMART_CART_DELETE') ?>" ><span class="delBut">x</span><?php echo vmText::_ ('COM_VIRTUEMART_CART_DELETE') ?></button>
<button type="submit" class="vmicon vm2-add_quantity_cart sprite" name="updatecart.<?php echo $pkey ?>" title="<?php echo vmText::_ ('COM_VIRTUEMART_CART_UPDATE') ?>" ></button>
我想知道为什么会发生这种情况,因为在第二个版本中似乎都会执行提交按钮。没有Java Script,是否有充分的解决方案。