magento 产品页数量 增加减少按钮

1,735 人次阅读
没有评论

共计 830 个字符,预计需要花费 3 分钟才能阅读完成。

app/design/frontend/base/default/template/catalog/product/view/addtocart.phtml
[php]
<script type="text/javascript">
function addQtyone(){
var qtyPro=$(‘qty’);
qtyPro.value = parseInt(qtyPro.value)+1;
}
function redQtyone(){
var qtyPro=$(‘qty’);
if(qtyPro.value<2){
alert("At least 1 !");
}else{
qtyPro.value = parseInt(qtyPro.value)-1;
}
}
</script>

<p class="QtyContent"><label for="qty"><?php echo $this->__(‘Qty:’) ?></label>
<span class="reduceQty" onclick="redQtyone();">-</span>
<!–<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__(‘Qty’) ?>" class="input-text qty" /> –>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__(‘Qty’) ?>" class="input-text qty" />
<span class="addQty" onclick="addQtyone();">+</span>
</p>[/php]

正文完
 0