0

我在 prestashop 上有以下代码。我正在尝试将 {$combination.price} 降低 20%。但是最后更改数组似乎不起作用?即{$combination.price/1.2)

谁能帮帮我,我怎样才能以 20% 的折扣退回价格?

{if isset($groups)}
// Combinations
{foreach from=$combinations key=idCombination item=combination}
    var specific_price_combination = new Array();
    var available_date = new Array();
    specific_price_combination['reduction_percent'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 

'percentage'}{$combination.specific_price.reduction*100}{else}0{/if};
    specific_price_combination['reduction_price'] = {if $combination.specific_price AND $combination.specific_price.reduction AND $combination.specific_price.reduction_type == 

'amount'}{$combination.specific_price.reduction}{else}0{/if};
    specific_price_combination['price'] = {if $combination.specific_price AND $combination.specific_price.price}{$combination.specific_price.price}{else}0{/if};
    specific_price_combination['reduction_type'] = '{if $combination.specific_price}{$combination.specific_price.reduction_type}{/if}';
    specific_price_combination['id_product_attribute'] = {if $combination.specific_price}{$combination.specific_price.id_product_attribute|intval}{else}0{/if};
    available_date['date'] = '{$combination.available_date}';
    available_date['date_formatted'] = '{dateFormat date=$combination.available_date full=false}';
    addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, 

 '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity}, available_date, specific_price_combination);
    {/foreach}

{/if}
4

1 回答 1

0

$price * 0.8或者$price - ( $price * 0.2 )无论哪种方式,它们都有相同的最终结果。第一个是变量 $price 乘以 80%,这将是 20% 赤字的价格。第二个示例是变量 $price 减去变量 $price 乘以 20%,假设您将 $price 替换为您尝试以 20% 的赤字返回的实际变量,这将是价格减去价格的 20%。

于 2013-06-18T19:00:58.550 回答