# Zugriff auf aktuell ausgewählte Währung

**URL:** <https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445>\
**Category:** Shopware 3.5\
**Tags:** themes--design\
**Created:** [9. September 2013 um 17:05 UTC](https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445 "2013-09-09T17:05:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sid](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sid](https://forum.shopware.com/u/Sid)\
**Post date:** [9. September 2013 um 17:05 UTC](https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445/1 "2013-09-09T17:05:37Z")

</div>

Ich muss die Artikel-Detail-Seite (frontend/detail/index.tpl) anpassen um ein Script einzubinden. Das funktioniert soweit auch, über $sArticle hab ich Zugriff auf alle Variablen/Werte die ich brauche (Name, Preis, Bestand, etc). Allerdings bräuchte ich auch Zugriff auf die Währung, die der User aktuell eingestellt hat, also entweder EUR oder USD. Ich habe es schon mit „{$sCurrency}“ und „{$sCurrency.currency}“ versucht, aber anscheinend gibt es diese Variable nicht, den es wird mir nichts ausgegeben. Hat noch jemand eine Idee? Auch mit dem Firebug konnte ich nichts finden 😕

---

<div class="post-metadata">

**Author:** ![Stephan\_Pohl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/stephan_pohl/32/10212_2.png) [@Stephan\_Pohl](https://forum.shopware.com/u/Stephan_Pohl)\
**Post date:** [9. September 2013 um 17:26 UTC](https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445/2 "2013-09-09T17:26:52Z")

</div>

Hallo @Sid, ich mache es meistens so, dass ich mir im Template einfach einen 0 Preis per Smarty formatiere, in Javascript auslese und als Template für meine clientseitige Formatierung verwende. [code]

{0|currency}  
[/code] ` var formatCurrency = function (value) { var me = this; var currencyFormat = me.$element.find('.currency-helper').text(); value = Math.round(value \* 100) / 100; value = value.toFixed(2); if (currencyFormat.indexOf('0.00') \> 0) { value = currencyFormat.replace('0.00', value); } else { value = value.replace('.', ','); value = currencyFormat.replace('0,00', value); } return value; }; ` Viele Grüße, Stephan Pohl :shopware:

---

<div class="post-metadata">

**Author:** ![zenit](https://avatars.discourse-cdn.com/v4/letter/z/a87d85/32.png) [@zenit](https://forum.shopware.com/u/zenit)\
**Post date:** [3. Januar 2016 um 17:58 UTC](https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445/3 "2016-01-03T17:58:55Z")

</div>

Hallo, habe versucht das ganze nach dieser Anleitung zu verweirklichen: [https://developers.shopware.com/designe … base-class](https://developers.shopware.com/designers-guide/javascript-statemanager-and-pluginbase/#plugin-base-class) `;(function ($) { "use strict"; /\*\* \* Shopware Currency Helper \* \*/ $.plugin('currencyHelper', { /\*\* \* The Defaults \*/ defaults: { }, /\*\* \* The "init" currencyHelper \*/ init: function(value) { var me = this; me.$currencyFormat = me.$el.find('.currency-helper').text(); console.log('currencyFormat:' + me.$currencyFormat); value = Math.round(value \* 100) / 100; value = value.toFixed(2); if (me.$currencyFormat.indexOf('0.00') \> 0) { value = me.$currencyFormat.replace('0.00', value); } else { value = value.replace('.', ','); value = me.$currencyFormat.replace('0,00', value); } return value; } }); StateManager.addPlugin('html', 'currencyHelper', ['xs', 's', 'm', 'l', 'xl']); }(jQuery)); ` Am Ende ist value = NAN € Leider bleibt im DOM 0,00 € stehen und wird nicht ersetzt. Kann jemand helfen? Beste Grüße, ZENIT

---

<div class="post-metadata">

**Author:** ![zenit](https://avatars.discourse-cdn.com/v4/letter/z/a87d85/32.png) [@zenit](https://forum.shopware.com/u/zenit)\
**Post date:** [5. Januar 2016 um 14:17 UTC](https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445/4 "2016-01-05T14:17:44Z")

</div>

Jemand eine Ahnung?

---

<div class="post-metadata">

**Author:** ![swkweb](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@swkweb](https://forum.shopware.com/u/swkweb)\
**Post date:** [27. Februar 2016 um 10:19 UTC](https://forum.shopware.com/t/zugriff-auf-aktuell-ausgewahlte-wahrung/15445/5 "2016-02-27T10:19:29Z")

</div>

Hallo zenit,

vielleicht ist es so, dass die Variable&nbsp;value anstatt einem Punkt ein Komma hat?  
Ich persönlich mag aber nicht wenn man solche Ersetzungen in Javascript machen muss, meine Lösung für die Währung direkt in Smarty ist:

```
{''|currency:use_symbol|replace:'0.00 ':''|replace:'0,00 ':''}

```

Beste Grüße  
Max
