Jump to content

Calculo De Desconto - Prestashop 1.6


Recommended Posts

Olá,

 

Estou com o seguinte problema e precisava da vossa ajuda:

Tenho duas colunas que criei para exibir desconto de 4% e de 6% nos descontos de quantidades (imagem de exemplo em anexo)

O problema é que está a calcular mal o desconto, ou seja não está a considerar a segunda cada decimal do preço..

 

Ficheiro: hookproduct.tpl

 

Código:

 

{if isset($discount_infos)}

<div style="font-size:12px;" id="div_qdi_product_page">

<table class="std table-product-discounts">

    <thead>

    <tr>
    <th colspan="2"><strong>Quantidade</strong></th>
    <th colspan="2"><strong>Preço</strong></th>
    <th colspan="2"><strong>Poupança</strong></th>
    <th colspan="2"><strong>Preço c/ Desconto Financeiro<br/> 4%</strong></th>
    <th colspan="2"><strong>Preço c/ Desconto Financeiro<br/> 6%</strong></th>
    </tr>

    </thead>

    {foreach from=$discount_infos item=discount_info}

    <tr>

        <td colspan="2"><strong>{$discount_info['from_quantity']}{if empty($discount_info['to_quantity'])}+{else}-{$discount_info['to_quantity']}{/if}</strong></td>
        <td colspan="2"><strong>{$discount_info['final_price']}</strong></td>
        <td colspan="2"><strong>{$discount_info['real_value']}{if $discount_info['reduction_type'] != 'amount'}%{/if} {l s='Off' mod='agilequantitydiscountindicator'}</strong></td>
        <td class="table-product-preco" colspan="2"><strong>{convertPrice price=$discount_info['final_price']*0.96}</strong></td>
        <td class="table-product-preco" colspan="2"><strong>{convertPrice price=$discount_info['final_price']*0.94}</strong></td>

    </tr>

    {/foreach}

</table>

</div>

{/if}

 

 

 

post-1016202-0-61659400-1449525395_thumb.jpg

Link to comment
Share on other sites

Olá,

 

Estou com o seguinte problema e precisava da vossa ajuda:

Tenho duas colunas que criei para exibir desconto de 4% e de 6% nos descontos de quantidades (imagem de exemplo em anexo)

O problema é que está a calcular mal o desconto, ou seja não está a considerar a segunda cada decimal do preço..

 

Ficheiro: hookproduct.tpl

 

Código:

 

{if isset($discount_infos)}

 

<div style="font-size:12px;" id="div_qdi_product_page">

 

<table class="std table-product-discounts">

 

    <thead>

 

    <tr>

    <th colspan="2"><strong>Quantidade</strong></th>

    <th colspan="2"><strong>Preço</strong></th>

    <th colspan="2"><strong>Poupança</strong></th>

    <th colspan="2"><strong>Preço c/ Desconto Financeiro<br/> 4%</strong></th>

    <th colspan="2"><strong>Preço c/ Desconto Financeiro<br/> 6%</strong></th>

    </tr>

 

    </thead>

 

    {foreach from=$discount_infos item=discount_info}

 

    <tr>

 

        <td colspan="2"><strong>{$discount_info['from_quantity']}{if empty($discount_info['to_quantity'])}+{else}-{$discount_info['to_quantity']}{/if}</strong></td>

        <td colspan="2"><strong>{$discount_info['final_price']}</strong></td>

        <td colspan="2"><strong>{$discount_info['real_value']}{if $discount_info['reduction_type'] != 'amount'}%{/if} {l s='Off' mod='agilequantitydiscountindicator'}</strong></td>

        <td class="table-product-preco" colspan="2"><strong>{convertPrice price=$discount_info['final_price']*0.96}</strong></td>

        <td class="table-product-preco" colspan="2"><strong>{convertPrice price=$discount_info['final_price']*0.94}</strong></td>

 

    </tr>

 

    {/foreach}

 

</table>

 

</div>

 

{/if}

 

 

Bem simples, sua formula está errada, não é assim que se faz essa conta.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...