Joomla 1.5与Virtuemart 1.1.9

时间:2014-05-29 11:55:16

标签: php joomla content-management-system joomla1.5 virtuemart

我想在类别页面上添加更改,我自定义页面websitelink.com/components\com_virtuemart\themes\default\templates\browse\browse_3.php

我添加了代码

    <div class="addtocart_buttonList">
<?php 
$button_lbl = $VM_LANG->_('PHPSHOP_CART_ADD_TO');
$button_cls = 'addtocart_button';
if( CHECK_STOCK == '1' && ( $product_in_stock < 1 ) ) {
    $button_lbl = $VM_LANG->_('VM_CART_NOTIFY');
    $button_cls = 'notify_button';
    $notify = true;
} else {
    $notify = false;
}
?>

<form action="<?php echo $mm_action_url ?>index.php" method="post" name="addtocart" id="addtocart<?php echo $i ?>" class="addtocart_form" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) && !$notify ) { echo 'onsubmit="handleAddToCart( this.id );return false;"'; } ?>>

    <input type="submit" class="<?php echo $button_cls ?>" value="<?php echo $button_lbl    ?>" title="<?php echo $button_lbl ?>" />
    <input type="hidden" name="category_id" value="<?php echo  @$_REQUEST['category_id'] ?>" />
    <input type="hidden" name="product_id" value="<?php echo $product_id ?>" />
    <input type="hidden" name="prod_id[]" value="<?php echo $product_id ?>" />
    <input type="hidden" name="page" value="shop.cart" />
    <input type="hidden" name="func" value="cartadd" />
    <input type="hidden" name="Itemid" value="<?php echo $sess->getShopItemid() ?>" />
    <input type="hidden" name="option" value="com_virtuemart" />
    <input type="hidden" name="set_price[]" value="" />
    <input type="hidden" name="adjust_price[]" value="" />
    <input type="hidden" name="master_product[]" value="" />
</form>
</div>

添加此行后,添加到购物车按钮会出现在列表项上,但是我点击添加到购物车按钮时会出现错误

Please enter a valid quatity for this item

我如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您需要将数量指定为输入字段,隐藏或其他方式。我们只希望客户能够订购一件商品,因此添加了以下代码:

<input type="hidden" value="1" name="quantity">

让命名输入字段满足Virtuemart验证。