|
@ -9,7 +9,7 @@ $(document).ready(function () { |
|
|
$('#share_product_id').change(function () { |
|
|
$('#share_product_id').change(function () { |
|
|
var share_product_id = $("#share_product_id").val(); |
|
|
var share_product_id = $("#share_product_id").val(); |
|
|
ajax.jsonRpc("/subscription/get_share_product", 'call', { |
|
|
ajax.jsonRpc("/subscription/get_share_product", 'call', { |
|
|
'share_product_id': share_product_id |
|
|
|
|
|
|
|
|
'share_product_id': share_product_id, |
|
|
}) |
|
|
}) |
|
|
.then(function (data) { |
|
|
.then(function (data) { |
|
|
$('#share_price').text(data[share_product_id].list_price); |
|
|
$('#share_price').text(data[share_product_id].list_price); |
|
@ -18,14 +18,14 @@ $(document).ready(function () { |
|
|
$('input.js_quantity').data("min", data[share_product_id].min_qty); |
|
|
$('input.js_quantity').data("min", data[share_product_id].min_qty); |
|
|
} |
|
|
} |
|
|
$('input.js_quantity').change(); |
|
|
$('input.js_quantity').change(); |
|
|
var $share_price = $('#share_price').text() |
|
|
|
|
|
|
|
|
var $share_price = $('#share_price').text(); |
|
|
$('input[name="total_parts"]').val($('input.js_quantity').val()*$share_price); |
|
|
$('input[name="total_parts"]').val($('input.js_quantity').val()*$share_price); |
|
|
$('input[name="total_parts"]').change(); |
|
|
$('input[name="total_parts"]').change(); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$(oe_easymy_coop).on('click', 'a.js_add_cart_json', function (ev) { |
|
|
$(oe_easymy_coop).on('click', 'a.js_add_cart_json', function (ev) { |
|
|
var $share_price = $('#share_price').text() |
|
|
|
|
|
|
|
|
var $share_price = $('#share_price').text(); |
|
|
var $link = $(ev.currentTarget); |
|
|
var $link = $(ev.currentTarget); |
|
|
var $input = $link.parent().parent().find("input"); |
|
|
var $input = $link.parent().parent().find("input"); |
|
|
var $input_total = $("div").find(".total"); |
|
|
var $input_total = $("div").find(".total"); |
|
@ -34,7 +34,7 @@ $(document).ready(function () { |
|
|
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val(), 10); |
|
|
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val(), 10); |
|
|
var total_part = quantity * $share_price; |
|
|
var total_part = quantity * $share_price; |
|
|
var quantity_max = amount_max / $share_price; |
|
|
var quantity_max = amount_max / $share_price; |
|
|
$input.val(quantity > min ? (total_part <= amount_max ? quantity : quantity_max) : min); |
|
|
|
|
|
|
|
|
$input.val(quantity > min ? total_part <= amount_max ? quantity : quantity_max : min); |
|
|
$input.change(); |
|
|
$input.change(); |
|
|
$('input[name="total_parts"]').val($input.val()*$share_price); |
|
|
$('input[name="total_parts"]').val($input.val()*$share_price); |
|
|
return false; |
|
|
return false; |
|
|