[ 
http://jira.magnolia-cms.com/browse/MSHOP-31?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jan Haderka updated MSHOP-31:
-----------------------------

    Description: 
The TemplateProductPriceBean formats the prices according to the pattern stored 
with the currency in the shop configuration, but it does not respect the 
current local stored in the aggregation state (instead uses the default 
locale). This "patch" would fix the problem:

{code}
    public String getPrice() {
        try {
            if (price >= 0 && StringUtils.isNotBlank(this.getFormatting())) {
                NumberFormat formatter = 
NumberFormat.getNumberInstance(MgnlContext.getAggregationState().getLocale());
                DecimalFormat df = (DecimalFormat)formatter;
                df.applyPattern(this.getFormatting());
                return df.format(price);
            }
        } catch (Exception e) {
            log.error("error reading price", e);
        }
        return "" + price;
    }
{code}

  was:
The TemplateProductPriceBean formats the prices according to the pattern stored 
with the currency in the shop configuration, but it does not respect the 
current local stored in the aggregation state (instead uses the default 
locale). This "patch" would fix the problem:


    public String getPrice() {
        try {
            if (price >= 0 && StringUtils.isNotBlank(this.getFormatting())) {
                NumberFormat formatter = 
NumberFormat.getNumberInstance(MgnlContext.getAggregationState().getLocale());
                DecimalFormat df = (DecimalFormat)formatter;
                df.applyPattern(this.getFormatting());
                return df.format(price);
            }
        } catch (Exception e) {
            log.error("error reading price", e);
        }
        return "" + price;
    }



> Prices are not properly formatted
> ---------------------------------
>
>                 Key: MSHOP-31
>                 URL: http://jira.magnolia-cms.com/browse/MSHOP-31
>             Project: Magnolia Shop
>          Issue Type: Bug
>            Reporter: Will Scheidegger
>            Assignee: Teresa Miyar
>             Fix For: 1.1.1
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The TemplateProductPriceBean formats the prices according to the pattern 
> stored with the currency in the shop configuration, but it does not respect 
> the current local stored in the aggregation state (instead uses the default 
> locale). This "patch" would fix the problem:
> {code}
>     public String getPrice() {
>         try {
>             if (price >= 0 && StringUtils.isNotBlank(this.getFormatting())) {
>                 NumberFormat formatter = 
> NumberFormat.getNumberInstance(MgnlContext.getAggregationState().getLocale());
>                 DecimalFormat df = (DecimalFormat)formatter;
>                 df.applyPattern(this.getFormatting());
>                 return df.format(price);
>             }
>         } catch (Exception e) {
>             log.error("error reading price", e);
>         }
>         return "" + price;
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to