Проблема со скидкой

Автор MrWoolf, 09 октября 2014, 15:33:17

« назад - далее »

MrWoolf

Цитата: Adik от 09 октября 2014, 21:36:49
ЦитироватьТ.е. джава не работали и все цены были нормальные.
Значит точно у вас подмена полей через javascript.

Смотреть какие js-файлы полключаются можно в firefox. Установите firebug, занрузине нужную страницу, нажмите F12.
Выберите Script, покажет все js-файлы.
Затем ищите в эих файлах поиском название поля, в котором меняется цена.

Нашел что-то интересное...
combinationsJS[k]['specific_price'] = [];
combinationsJS[k]['specific_price']['reduction_percent'] = (combinations[i]['specific_price'] && combinations[i]['specific_price']['reduction'] && combinations[i]['specific_price']['reduction_type'] == 'percentage') ? combinations[i]['specific_price']['reduction'] * 100 : 0;
combinationsJS[k]['specific_price']['reduction_price'] = (combinations[i]['specific_price'] && combinations[i]['specific_price']['reduction'] && combinations[i]['specific_price']['reduction_type'] == 'amount') ? combinations[i]['specific_price']['reduction'] : 0;
combinationsJS[k]['price'] = (combinations[i]['specific_price'] && combinations[i]['specific_price']['price'] && parseInt(combinations[i]['specific_price']['price']) != -1) ? combinations[i]['specific_price']['price'] :  combinations[i]['price'];

combinationsJS[k]['reduction_type'] = (combinations[i]['specific_price'] && combinations[i]['specific_price']['reduction_type']) ? combinations[i]['specific_price']['reduction_type'] : '';
combinationsJS[k]['id_product_attribute'] = (combinations[i]['specific_price'] && combinations[i]['specific_price']['id_product_attribute']) ? combinations[i]['specific_price']['id_product_attribute'] : 0;
k++;
}
combinations = combinationsJS;
}

MrWoolf

Я думаю вот этот файл, в котором ошибка вывода.

MrWoolf

#17
Все разобрался! Всем спасибо за активность.
Проблема было вот в чем:
вот исходный код...
if (product_specific_price.reduction_type == 'percentage')
reduction_percent = productPriceDisplay * parseFloat(product_specific_price.reduction);

reduction = reduction_price + reduction_percent;
if (reduction_price && (displayPrice || noTaxForThisProduct))
reduction = ps_round(reduction / tax, 6);
}

if (selectedCombination.specific_price)
{
if (selectedCombination.specific_price.reduction_percent > 0) {
$('#reduction_amount').hide();
$('#reduction_percent_display').html('-' + parseFloat(selectedCombination['specific_price'].reduction_percent) + '%');
$('#reduction_percent').show();
} else if (selectedCombination.specific_price.reduction_price > 0) {
$('#reduction_amount_display').html('-' + formatCurrency(reduction_price, currencyFormat, currencySign, currencyBlank));
$('#reduction_percent').hide();
$('#reduction_amount').show();
} else {
$('#reduction_percent').hide();
$('#reduction_amount').hide();
}
}


вот исправленный код:

if (product_specific_price.reduction_type == 'percentage')
reduction_percent = productPriceDisplay * parseInt(product_specific_price.reduction);

reduction = reduction_price + reduction_percent;
if (reduction_price && (displayPrice || noTaxForThisProduct))
reduction = ps_round(reduction / tax, 6);
}

if (selectedCombination.specific_price)
{
if (selectedCombination.specific_price.reduction_percent > 0) {
$('#reduction_amount').hide();
$('#reduction_percent_display').html('-' + parseInt(selectedCombination['specific_price'].reduction_percent) + '%');
$('#reduction_percent').show();
} else if (selectedCombination.specific_price.reduction_price > 0) {
$('#reduction_amount_display').html('-' + formatCurrency(reduction_price, currencyFormat, currencySign, currencyBlank));
$('#reduction_percent').hide();
$('#reduction_amount').show();
} else {
$('#reduction_percent').hide();
$('#reduction_amount').hide();
}
}
   
изменил значение атрибута parseFloat на parseInt