在Prestashop中将价格加到最终价格中

时间:2017-03-29 10:27:06

标签: php smarty prestashop

我用JS覆盖了产品前端的很大一部分。我希望能够从"添加到购物车"更新我的价格。按钮。目前,我的产品在后台的价格为1欧元,我还添加了JS金额。请参见随附的屏幕截图:

price

除非我点击"添加到购物车"价格为1欧元。

price2

我将价格奖励给这样的产品价格:

function updatePrice(tabOptions) {
// Update prices options
var format = price_format_page[tabOptions['is_format_page']];
var color = price_color_page[tabOptions['is_color_page']];
var impression = price_impression_page[tabOptions['is_impression_page']];
var paper = price_paper_page[tabOptions['is_paper_page']];
var reliure = price_reliure_page[tabOptions['is_reliure_page']];
var color_reliure = price_color_reliure_page[tabOptions['is_color_reliure_page']];
var finition = price_finition_page[tabOptions['is_finition_page']];

if (tabOptions['is_color_page'] === 'Couleur') {
    var page = price_per_page * tabOptions['page_value'];
} else {
    var page = price_per_page_nb * tabOptions['page_value'];
}

var total_options = format + color + impression + paper + reliure + color_reliure + finition + page + productPriceTaxExcluded;

/*// Get combination prices
 var combID = $('#idCombination').val();
 var combination = combinationsFromController[combID];
 if (typeof combination == 'undefined')
 return;*/

// Set product (not the combination) base price
var basePriceWithoutTax = total_options;
var basePriceWithTax = +productPriceTaxIncluded;
var priceWithGroupReductionWithoutTax = 0;

1 个答案:

答案 0 :(得分:1)

整个PrestaShop中产品的价格由Product.php类中定义的getPriceStatic()函数计算,该函数调用SpecificPrice.php类的getSpecificPrice()函数

如果您想在运行时更改产品的价格,那么最好覆盖SpecificPrice.php类的getSpecificPrice()函数

相关问题