Цитата |
---|
Андрей VG написал: Он же за помощью пришёл |
Ладно Андрей, помогу.
Это не реально сделать, цена за 2020 рассчитывается скриптом, функция recalculateprice() вызывается кликом на радиобатон
Скрытый текст |
---|
Код |
---|
function recalculateprice()
{
var main_price = 1505;
var input_quantity = Number($('input[name="quantity"]').val());
var special = 0;
var tax = 0;
discount_coefficient = 1;
if (isNaN(input_quantity)) input_quantity = 0;
main_price = process_discounts(main_price, input_quantity);
tax = process_discounts(tax, input_quantity);
var option_price = 0;
$('input:checked,option:selected').each(function() {
if ($(this).data('prefix') == '=') {
option_price += Number($(this).data('price'));
main_price = 0;
special = 0;
}
});
$('input:checked,option:selected').each(function() {
if ($(this).data('prefix') == '+') {
option_price += Number($(this).data('price'));
}
if ($(this).data('prefix') == '-') {
option_price -= Number($(this).data('price'));
}
if ($(this).data('prefix') == 'u') {
pcnt = 1.0 + (Number($(this).data('price')) / 100.0);
option_price *= pcnt;
main_price *= pcnt;
special *= pcnt;
}
if ($(this).data('prefix') == 'd') {
pcnt = 1.0 - (Number($(this).data('price')) / 100.0);
option_price *= pcnt;
main_price *= pcnt;
special *= pcnt;
}
if ($(this).data('prefix') == '*') {
option_price *= Number($(this).data('price'));
main_price *= Number($(this).data('price'));
special *= Number($(this).data('price'));
}
if ($(this).data('prefix') == '/') {
option_price /= Number($(this).data('price'));
main_price /= Number($(this).data('price'));
special /= Number($(this).data('price'));
}
});
special += option_price;
main_price += option_price;
tax = main_price;
// Process TAX.
main_price = calculate_tax(main_price);
special = calculate_tax(special);
if (input_quantity > 0) {
main_price *= input_quantity;
special *= input_quantity;
tax *= input_quantity;
}
// Display Main Price
animateMainPrice(main_price);
}
|
|