I am trying to send a value, from the Datalayer of my website, that has a few conditions. This is the code I currently have for obtaining the value from the backend and setting it into the data layer:
currency: '[{$oView->getCurrencyCovIndex()|string_format:"%.2f"}]'
The issue is that the results of this function are integers from 1 to 5, each representing a specific currency. So for example:
1=EUR
2=GBP
3=USD
.
.
.
What I would like to have is something that translates that result into the corresponding string values:
currency: switch(value) {
case 1:
currency = 'EUR'
break;
case 2:
currency = 'GBP'
break;
case 3:
currency = 'USD'
break;
}
The website is based on an oxidshop with a smarty tracking code template.
In newer OXID versions (tested with 4.9.x) the $currency
variable is available to all templates. Access it in your template like this:
[{assign var="sCurrencyName" value=$currency->name}]