|
|||
|
Hallo,
ich habe mit Smarty gerade eine Formel erstellt, die mir einen Prozentsatz ausrechnet. Die Formel sieht wie folgt aus: Code:
{math equation="100 - (100 / x * y)" x=$products_uvp y=$products_price.plain format="%.2f"}
Code:
{math equation="100 - (100 / x * y)" x=$products_uvp y=$products_price.plain format="%.2f"|replace:".":","}
MfG. Hansen |
|
|||
|
hi,
sieht nach price_special.html aus ..... hatte ähnliches Problem und so gelöst ( wichtig sind die speziellen Hochkommas "`" nach "value": {assign var=ersparnis value=`$OLD_PRICE.plain-$SPECIAL_PRICE.plain`} {txt key=TEXT_SPECIAL_SAVE} {$ersparnis|string_format:"%.2f"|replace:".":","} EUR gibt den Preisvorteil in Euro statt Prozent aus Grüsse |
|
|||
|
Hi oldbear,
das Snippet verwende ich in der porduct.html. $products_uvp ist ein eigens angelegtes Feld in der Datenbank. Und der Code rechnet die Ersparnis in % aus. Das klappt auch alles problemlos, nur kann ich den Punkt nicht gegen ein Komma ersetzen. Was ich aber mal ausprobieren werde, ist format gegen string_format auszutauschen. MfG. Hansen |
|
|||
|
ist zwar ein paar Monate zu spät, aber vielleicht hat jemand anderes ein ähnliches Problem.
Ich habe es so gelöst: Code:
{math assign="var_name" equation="100 - (100 / x * y)" x=$products_uvp y=$products_price.plain}{$var_name|string_format:"%.2f"|replace:".":","}
![]() meo |
![]() |
| Lesezeichen |
| Stichworte |
| equation, math, smarty |
| Themen-Optionen | |
| Ansicht | |
|
|
Ähnliche Themen
|
||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| xt:Commerct Shopsystem mit der Smarty Enginge | philipp1988 | Installation und Konfiguration | 5 | 24.03.2011 17:03 |
| Java-script-men? Mit Smarty Einbinden? | kolle | Template System | 4 | 23.06.2004 17:07 |
| Smarty Richtig Installieren | Beginner2 | Installation und Konfiguration | 18 | 10.06.2004 14:50 |