View Issue Details

IDProjectCategoryView StatusLast Update
0005036OXID eShop (all versions)1.03. Basket, checkout processpublic2013-04-11 13:07
Reportermark Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.7.4 / 5.0.4 revision 57063 
Fixed in Version4.7.5 / 5.0.5 
Summary0005036: smarty_modifier_oxnumberformat does not work with given precision
Descriptionhttp/core/smarty/plugins/modifier.oxnumberformat.php

Line 41 is
    $oCur->decimal = 0;//trim($sCur[5]);

This disables the precision given in the first parameter of the function
Steps To ReproduceCall function with

[{"EUR@ 1.00@ ,@ .@ €@ 2"|oxnumberformat:59.95}]

from template. Then change smarty plugin line 41 to

    $oCur->decimal = trim($sCur[5]);

Now function works as intended
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

mark

2013-04-03 15:07

reporter   ~0008555

You could also add

    if ($sFormat === "")
    {
        $oCur = null;
    }
    else
    {
        // logic copied from oxconfig::getCurrencyArray()
        $sCur = explode( "@", $sFormat);
        $oCur = new stdClass();
        $oCur->id = 0;
        $oCur->name = @trim($sCur[0]);
        $oCur->rate = @trim($sCur[1]);
        $oCur->dec = @trim($sCur[2]);
        $oCur->thousand = @trim($sCur[3]);
        $oCur->sign = @trim($sCur[4]);
        $oCur->decimal = @trim($sCur[5]);

        // change for US version
        if (isset($sCur[6])) {
            $oCur->side = @trim($sCur[6]);
        }
    }

So that if you call the plugin with ""|oxnumberformat:$dValue OXID automatically chooses the right format

tadas

2013-04-11 13:07

reporter   ~0008596

Fixed as proposed in the comments.