Автор Тема: Проблема со скидкой  (Прочитано 1689 раз)

09 Октябрь 2014, 22:01:16
Ответ #15
  • Новичок
  • *
  • Сообщений: 12
  • Репутация: +0/-0
  • Сообщество PrestaShop
    • Просмотр профиля
Цитировать
Т.е. джава не работали и все цены были нормальные.
Значит точно у вас подмена полей через 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;
}
09 Октябрь 2014, 22:18:40
Ответ #16
  • Новичок
  • *
  • Сообщений: 12
  • Репутация: +0/-0
  • Сообщество PrestaShop
    • Просмотр профиля
Я думаю вот этот файл, в котором ошибка вывода.
09 Октябрь 2014, 22:48:52
Ответ #17
  • Новичок
  • *
  • Сообщений: 12
  • Репутация: +0/-0
  • Сообщество PrestaShop
    • Просмотр профиля
Все разобрался! Всем спасибо за активность.
Проблема было вот в чем:
вот исходный код...
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