2017-01-05 5 views
0

私はCS-Cartの最新バージョンで少し問題があります。ドキュメント請求書に小計(税なし)と送料の新しいボックスを挿入する必要があります。私はこのスニペットを使用して、この値を表示するには小枝と十進数

{% set imptotale = o.display_subtotal + o.display_shipping_cost %} 
{{ imptotale|number_format(2, ',', '.') }} € 

残念ながら量が間違っています。

例:私のスニペットと

Subtotal: 65,10€ 
Shipping: 5,20€ 
Total: 70,30€ 

値のショー:

Subtotal: 65,10€ 
Shipping: 5,20€ 
Total: 70,00€ 

がどのように私はまた、小数を表示することができますか?

答えて

0

の問題は、あなたがTwigなく山車に向けて、文字列を送信しているという事実に産む:(JSONなど)

入力

{ 
    'subtotal' : 65.10, 
    'shipping' : 5.20, 
    'subtotal_str' : '65,10', 
    'shipping_str' : '5,20', 
} 

{% set total = subtotal + shipping %} 

{{ subtotal | number_format(2, ',', '.') }} 
{{ shipping | number_format(2, ',', '.') }} 
{{ total | number_format(2, ',', '.') }} 


{% set total = subtotal_str + shipping_str %} 

{{ subtotal_str }} 
{{ shipping_str }} 
{{ total | number_format(2, ',', '.') }} 

demo

を小枝