common.js如何加最小{$goods.min_number}函数

2016-07-07 15:03 来源:www.chinab4c.com 作者:ecshop专家

common.js如何加最小{$goods.min_number}函数,因为收藏的商品加进购物车都是一件的!我想在下面加,但不起作用,那位大大可以指点下,小弟在此感激。。。。


//获取选择属性后,再次提交到购物车
function submit_div(goods_id)
{
var goods= new Object();
var spec_arr= new Array();
var fittings_arr = new Array();
var number = 1;
var input_arr= document.getElementsByTagName('input');
var spec_arr = new Array();
var j = 0;
for (i = 0; i < input_arr.length; i ++ )
{
var prefix = input_arr.name.substr(0, 5);
if (prefix == 'spec_' && (
((input_arr.type == 'radio' || input_arr.type == 'checkbox') && input_arr.checked)))
{
spec_arr[j] = input_arr.value;
j++ ;
}
}
goods.spec= spec_arr;
goods.goods_id = goods_id;
goods.number= number;
goods.parent= (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.toJSONString(), addToCartResponse, 'POST', 'JSON');
document.body.removeChild(docEle('speDiv'));
document.body.removeChild(docEle('mask'));
var i = 0;
var sel_obj = document.getElementsByTagName('select');
while (sel_obj)
{
sel_obj.style.visibility = "";
i++;
}
}

回答:
var number ={$goods.min_number} ;

有成功的吗?