Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Odejmowanie wartości w smarty
4Axis
post
Post #1





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 14.05.2014

Ostrzeżenie: (0%)
-----


Witam.
Chciałbym się zapytać czy jest mozliwe i jak odjęcie 2 wartości w smarty (Prestashop).
Wyświetlam dwie wartości w ten sposób:
  1. <span id="cart_blockuserinfo">{displayPrice price=$cart->getordertotal(false)}</span>
  2. <span><p>{foreach $displayVouchers as $voucher} {$voucher.reduction_amount} {/foreach}</p></span>


displayPrice jest ładowany dynamicznie z ajax-cart.js
czy można je od siebie jakoś odjąć?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




displayPrice to plugin a nie zmienna.


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
4Axis
post
Post #3





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 14.05.2014

Ostrzeżenie: (0%)
-----


Nie wiem co to jest, jestem laikiem. Dlatego proszę o pomoc wink.gif
Go to the top of the page
+Quote Post
Pyton_000
post
Post #4





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


http://www.smarty.net/docsv2/en/language.function.math.tpl
Go to the top of the page
+Quote Post
4Axis
post
Post #5





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 14.05.2014

Ostrzeżenie: (0%)
-----


Dla zainteresowanych, poniższy kod jest ok:
  1. <span id="cart_blockuserinfo">
  2. {displayPrice price=$cart->getordertotal(false)}
  3. </span>
  4. <span>
  5. <p>{foreach $displayVouchers as $voucher} {$voucher.reduction_amount} ({displayPrice price=$cart->getordertotal(false) - $voucher.reduction_amount}) {/foreach}</p>
  6. </span>
Go to the top of the page
+Quote Post
Martin-ZG
post
Post #6





Grupa: Zarejestrowani
Postów: 28
Pomógł: 3
Dołączył: 23.07.2009

Ostrzeżenie: (10%)
X----


Cytat(4Axis @ 10.07.2014, 15:24:10 ) *
Dla zainteresowanych, poniższy kod jest ok:
  1. <span id="cart_blockuserinfo">
  2. {displayPrice price=$cart->getordertotal(false)}
  3. </span>
  4. <span>
  5. <p>{foreach $displayVouchers as $voucher} {$voucher.reduction_amount} ({displayPrice price=$cart->getordertotal(false) - $voucher.reduction_amount}) {/foreach}</p>
  6. </span>


Jest ok, ale dla smarty 3, w smarty 2 nie za bardzo przechodzi takie odejmowanie trzeba używać math.
Go to the top of the page
+Quote Post
4Axis
post
Post #7





Grupa: Zarejestrowani
Postów: 42
Pomógł: 0
Dołączył: 14.05.2014

Ostrzeżenie: (0%)
-----


a czy można na podstawie wyniku takiego odejmowania utworzyć warunek np. jeżeli wynik jest ujemny to pokaże jakiś tekst, a jeżeli dodatni to pokaże wynik?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 13:16