Währungsformatierungen im PrestaShop anpassen: Unterschied zwischen den Versionen
Aus ITwiki
Franky (Diskussion | Beiträge) |
Franky (Diskussion | Beiträge) |
||
Zeile 118: | Zeile 118: | ||
</source> | </source> | ||
+ | <poll> | ||
+ | War dieser Artikel für Dich hilfreich? | ||
+ | Ja | ||
+ | Nein | ||
+ | </poll> | ||
[[Kategorie:Webdesign]] | [[Kategorie:Webdesign]] |
Aktuelle Version vom 29. August 2013, 15:54 Uhr
Um ein weiteres Währungsformat zum PrestaShop hinzuzufügen, müssen untenstehende Dateien bearbeitet werden. Hier wurde bereits das Format 00.000,00X mit dem Key 6 hinzugefügt.
1. AdminCurrencies.php im Ordner prestashop/controllers/admin/
'query' => array(
array('key' => 1, 'name' => 'X0,000.00 ('.$this->l('as with Dollars').')'),
array('key' => 2, 'name' => '0 000,00X ('.$this->l('as with Euros').')'),
array('key' => 3, 'name' => 'X0.000,00'),
array('key' => 4, 'name' => '0,000.00X'),
array('key' => 5, 'name' => '0 000.00X'), // Added for the switzerland currency
array('key' => 6, 'name' => '0.000,00X')
),
2. Tools.php im Ordner prestashop/classes/
switch ($c_format)
{
/* X 0,000.00 */
case 1:
$ret = $c_char.$blank.number_format($price, $c_decimals, '.', ',');
break;
/* 0 000,00 X*/
case 2:
$ret = number_format($price, $c_decimals, ',', ' ').$blank.$c_char;
break;
/* X 0.000,00 */
case 3:
$ret = $c_char.$blank.number_format($price, $c_decimals, ',', '.');
break;
/* 0,000.00 X */
case 4:
$ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char;
break;
/* 0 000.00 X Added for the switzerland currency */
case 5:
$ret = number_format($price, $c_decimals, '.', ' ').$blank.$c_char;
break;
/* 0.000,00 X */
case 6:
$ret = number_format($price, $c_decimals, ',', '.').$blank.$c_char;
break;
}
3. tools.js im Ordner prestashop/js/
function formatedNumberToFloat(price, currencyFormat, currencySign)
{
price = price.replace(currencySign, '');
if (currencyFormat == 1)
return parseFloat(price.replace(',', '').replace(' ', ''));
else if (currencyFormat == 2)
return parseFloat(price.replace(' ', '').replace(',', '.'));
else if (currencyFormat == 3)
return parseFloat(price.replace('.', '').replace(' ', '').replace(',', '.'));
else if (currencyFormat == 4)
return parseFloat(price.replace(',', '').replace(' ', ''));
else if (currencyFormat == 6)
return parseFloat(price.replace('.', '').replace(' ', '').replace(',', '.'));
return price;
}
if (currencyBlank > 0)
blank = ' ';
if (currencyFormat == 1)
return currencySign + blank + formatNumber(price, priceDisplayPrecision, ',', '.');
if (currencyFormat == 2)
return (formatNumber(price, priceDisplayPrecision, ' ', ',') + blank + currencySign);
if (currencyFormat == 3)
return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '.', ','));
if (currencyFormat == 4)
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
if (currencyFormat == 5)
return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign);
if (currencyFormat == 6)
return (formatNumber(price, priceDisplayPrecision, '.', ',') + blank + currencySign);
return price;
}
4. tools.js im jeweiligen Theme Ordner prestashop/themes/prestashop/js/
function formatedNumberToFloat(price, currencyFormat, currencySign)
{
price = price.replace(currencySign, '');
if (currencyFormat === 1)
return parseFloat(price.replace(',', '').replace(' ', ''));
else if (currencyFormat === 2)
return parseFloat(price.replace(' ', '').replace(',', '.'));
else if (currencyFormat === 3)
return parseFloat(price.replace('.', '').replace(' ', '').replace(',', '.'));
else if (currencyFormat === 4)
return parseFloat(price.replace(',', '').replace(' ', ''));
else if (currencyFormat === 6)
return parseFloat(price.replace('.', '').replace(' ', '').replace(',', '.'));
return price;
}
if (currencyBlank > 0)
blank = ' ';
if (currencyFormat == 1)
return currencySign + blank + formatNumber(price, priceDisplayPrecision, ',', '.');
if (currencyFormat == 2)
return (formatNumber(price, priceDisplayPrecision, ' ', ',') + blank + currencySign);
if (currencyFormat == 3)
return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '.', ','));
if (currencyFormat == 4)
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
if (currencyFormat == 5)
return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign);
if (currencyFormat == 6)
return (formatNumber(price, priceDisplayPrecision, '.', ',') + blank + currencySign);
return price;
}
War dieser Artikel für Dich hilfreich?
Bitte stimme unten ab.
0
0
Es wurden seit Erstellung der Umfrage am 16:11, 12. Jul. 2017 0 Stimmen abgegeben.
poll-id 54BE9D4B6F0F3ECEE7EB51B4072B9857