Prestashop 预购物车节省金额

Prestashop 预购物车节省金额,prestashop,cart,Prestashop,Cart,我在Prestashop 1.6.0.9上,我想在购物车页面上添加一个块:“保存金额”,就在“总计”下面。 我使用特定的价格,我想向客户展示他们节省了多少钱。 我该怎么做? 我想我必须使用cart-summary.js文件 // Block cart $('#cart_block_shipping_cost').show(); $('#cart_block_shipping_cost').next().show(); if (json.total_shipping > 0) { i

我在Prestashop 1.6.0.9上,我想在购物车页面上添加一个块:“保存金额”,就在“总计”下面。 我使用特定的价格,我想向客户展示他们节省了多少钱。 我该怎么做? 我想我必须使用cart-summary.js文件

// Block cart
$('#cart_block_shipping_cost').show();
$('#cart_block_shipping_cost').next().show();
if (json.total_shipping > 0)
{
    if (priceDisplayMethod !== 0)
    {
        $('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping_tax_exc, currencyFormat, currencySign, currencyBlank));
        $('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping_tax_exc, currencyFormat, currencySign, currencyBlank));
        $('#cart_block_total').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
    }
    else
    {
        $('#cart_block_shipping_cost').html(formatCurrency(json.total_shipping, currencyFormat, currencySign, currencyBlank));
        $('#cart_block_wrapping_cost').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank));
        $('#cart_block_total').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
    }
}
else
{
    if (json.carrier.id == null)
    {
        $('#cart_block_shipping_cost').hide();
        $('#cart_block_shipping_cost').next().hide();
    }
}

$('#cart_block_tax_cost').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
$('.ajax_cart_quantity').html(nbrProducts);

// Cart summary
$('#summary_products_quantity').html(nbrProducts + ' ' + (nbrProducts > 1 ? txtProducts : txtProduct));
if (priceDisplayMethod !== 0)
    $('#total_product').html(formatCurrency(json.total_products, currencyFormat, currencySign, currencyBlank));
else
    $('#total_product').html(formatCurrency(json.total_products_wt, currencyFormat, currencySign, currencyBlank));
$('#total_price').html(formatCurrency(json.total_price, currencyFormat, currencySign, currencyBlank));
$('#total_price_without_tax').html(formatCurrency(json.total_price_without_tax, currencyFormat, currencySign, currencyBlank));
$('#total_tax').html(formatCurrency(json.total_tax, currencyFormat, currencySign, currencyBlank));
问题是我有可变的总价格(有折扣),但没有没有折扣的总价格。 如何添加不打折的总价?

检查此主题:

特别是#20:

作者:来自prestashop.com的Gowtham

在shopping-cart.js中添加574左右的变量初始化

var total_disc =0;
var price_disc =0;
total_disc +=(product_list[i].price_without_quantity_discount*product_list[i].quantity_without_customization
在shopping-cart.js的第652行添加以下代码

var total_disc =0;
var price_disc =0;
total_disc +=(product_list[i].price_without_quantity_discount*product_list[i].quantity_without_customization
-产品清单[i]。价格*产品清单[i]。数量(无需定制); 价格盘=((产品清单[i]。无数量折扣的价格-产品清单[i]。价格 )*产品清单[i]。数量(无需定制); $('price_disc_'+key_for_blockcart).html(formatCurrency(price_disc,currencyFormat,currencySign,currencyBlank))

使用shopping-cart.tpl中的总折扣价格作为总折扣的id 和使用

price_disc_{$product.id_product}_{$product.id_product_attribute}{if
$quantityDisplayed> 0}nocustom{/if}{$product.id_address_delivery|intval}{if !空($product.gift)}u gift{/if}

作为产品折扣的shopping-cart-product-line.tpl中的id。这个 上面显示的代码是js中用于区块车的密钥的表示