You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2009/05/27 18:06:49 UTC

svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Author: mor
Date: Wed May 27 16:06:48 2009
New Revision: 779221

URL: http://svn.apache.org/viewvc?rev=779221&view=rev
Log:
Localized Unit Price input field in showcartitems.ftl. Patch from Mridul Pathak, part of OFBIZ-2530 (https://issues.apache.org/jira/browse/OFBIZ-2530)

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl Wed May 27 16:06:48 2009
@@ -250,7 +250,7 @@
                     <#else>
                         <#assign price = cartLine.getBasePrice()>
                     </#if>
-                    <input size="6" type="text" name="price_${cartLineIndex}" value="${price}"/>
+                    <input size="8" type="text" name="price_${cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
                 </#if>
               </div>
             </td>



Re: svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Posted by Adrian Crum <ad...@hlmksw.com>.
David,

Good point. Thanks for the info!

-Adrian

David E Jones wrote:
> 
> Actually if it is currency you should NOT use the ?string.currency 
> built-in because you can't tell it which currency you want displayed (it 
> uses the default currency for the users locale, which is often 
> incorrect). That is why we have the @ofbizCurrency transform, for example:
> 
> <@ofbizCurrency amount=price.price isoCode=price.currencyUsed/>
> 
> -David
> 
> 
> On May 27, 2009, at 10:55 AM, Adrian Crum wrote:
> 
>> Vikas,
>>
>> I will let you decide. I don't know what the motivation was for making 
>> the change.
>>
>> Freemarker knows the user's locale, so numbers should be formatted 
>> correctly. If you want a number formatted as currency, then you use 
>> the ?string.currency built-in. The result should be currency formatted 
>> according to the user's locale.
>>
>> I don't know if the ofbizAmount transform does something in addition 
>> to that.
>>
>> Try it out and see.
>>
>> -Adrian
>>
>> Vikas Mayur wrote:
>>> Hi Adrian,
>>> Thanks for the pointer. Do you think we should also change similar 
>>> pattern followed in editorderitems.ftl as there are examples for both?
>>> Vikas
>>> On May 27, 2009, at 9:57 PM, Adrian Crum wrote:
>>>> A simpler way to do this would be to use:
>>>>
>>>> <input size="6" type="text" name="price_${cartLineIndex}" 
>>>> value="${price?string.currency}"/>
>>>>
>>>> -Adrian
>>>>
>>>> mor@apache.org wrote:
>>>>> Author: mor
>>>>> Date: Wed May 27 16:06:48 2009
>>>>> New Revision: 779221
>>>>> URL: http://svn.apache.org/viewvc?rev=779221&view=rev
>>>>> Log:
>>>>> Localized Unit Price input field in showcartitems.ftl. Patch from 
>>>>> Mridul Pathak, part of OFBIZ-2530 
>>>>> (https://issues.apache.org/jira/browse/OFBIZ-2530)
>>>>> Modified:
>>>>>   
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>>>>
>>>>> Modified: 
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>>>>
>>>>> URL: 
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff 
>>>>>
>>>>> ============================================================================== 
>>>>>
>>>>> --- 
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>>>> (original)
>>>>> +++ 
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>>>> Wed May 27 16:06:48 2009
>>>>> @@ -250,7 +250,7 @@
>>>>>                    <#else>
>>>>>                        <#assign price = cartLine.getBasePrice()>
>>>>>                    </#if>
>>>>> -                    <input size="6" type="text" 
>>>>> name="price_${cartLineIndex}" value="${price}"/>
>>>>> +                    <input size="8" type="text" 
>>>>> name="price_${cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
>>>>>                </#if>
>>>>>              </div>
>>>>>            </td>
> 
> 

Re: svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Posted by David E Jones <da...@hotwaxmedia.com>.
Actually if it is currency you should NOT use the ?string.currency  
built-in because you can't tell it which currency you want displayed  
(it uses the default currency for the users locale, which is often  
incorrect). That is why we have the @ofbizCurrency transform, for  
example:

<@ofbizCurrency amount=price.price isoCode=price.currencyUsed/>

-David


On May 27, 2009, at 10:55 AM, Adrian Crum wrote:

> Vikas,
>
> I will let you decide. I don't know what the motivation was for  
> making the change.
>
> Freemarker knows the user's locale, so numbers should be formatted  
> correctly. If you want a number formatted as currency, then you use  
> the ?string.currency built-in. The result should be currency  
> formatted according to the user's locale.
>
> I don't know if the ofbizAmount transform does something in addition  
> to that.
>
> Try it out and see.
>
> -Adrian
>
> Vikas Mayur wrote:
>> Hi Adrian,
>> Thanks for the pointer. Do you think we should also change similar  
>> pattern followed in editorderitems.ftl as there are examples for  
>> both?
>> Vikas
>> On May 27, 2009, at 9:57 PM, Adrian Crum wrote:
>>> A simpler way to do this would be to use:
>>>
>>> <input size="6" type="text" name="price_${cartLineIndex}" value="$ 
>>> {price?string.currency}"/>
>>>
>>> -Adrian
>>>
>>> mor@apache.org wrote:
>>>> Author: mor
>>>> Date: Wed May 27 16:06:48 2009
>>>> New Revision: 779221
>>>> URL: http://svn.apache.org/viewvc?rev=779221&view=rev
>>>> Log:
>>>> Localized Unit Price input field in showcartitems.ftl. Patch from  
>>>> Mridul Pathak, part of OFBIZ-2530 (https://issues.apache.org/jira/browse/OFBIZ-2530 
>>>> )
>>>> Modified:
>>>>   ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>>>> showcartitems.ftl
>>>> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/ 
>>>> cart/showcartitems.ftl
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>>>> showcartitems.ftl (original)
>>>> +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>>>> showcartitems.ftl Wed May 27 16:06:48 2009
>>>> @@ -250,7 +250,7 @@
>>>>                    <#else>
>>>>                        <#assign price = cartLine.getBasePrice()>
>>>>                    </#if>
>>>> -                    <input size="6" type="text" name="price_$ 
>>>> {cartLineIndex}" value="${price}"/>
>>>> +                    <input size="8" type="text" name="price_$ 
>>>> {cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
>>>>                </#if>
>>>>              </div>
>>>>            </td>


Re: svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Posted by BJ Freeman <bj...@free-man.net>.
I put this under a new page in FAQ
http://docs.ofbiz.org/display/OFBIZ/Code+Snippets

will be going back thru the emails and pulling these out.

David E Jones sent the following on 5/27/2009 10:23 AM:
> 
> Actually if it is currency you should NOT use the ?string.currency
> built-in because you can't tell it which currency you want displayed (it
> uses the default currency for the users locale, which is often
> incorrect). That is why we have the @ofbizCurrency transform, for example:
> 
> <@ofbizCurrency amount=price.price isoCode=price.currencyUsed/>
> 
> -David
> 
> 
> On May 27, 2009, at 10:55 AM, Adrian Crum wrote:
> 
>> Vikas,
>>
>> I will let you decide. I don't know what the motivation was for making
>> the change.
>>
>> Freemarker knows the user's locale, so numbers should be formatted
>> correctly. If you want a number formatted as currency, then you use
>> the ?string.currency built-in. The result should be currency formatted
>> according to the user's locale.
>>
>> I don't know if the ofbizAmount transform does something in addition
>> to that.
>>
>> Try it out and see.
>>
>> -Adrian
>>
>> Vikas Mayur wrote:
>>> Hi Adrian,
>>> Thanks for the pointer. Do you think we should also change similar
>>> pattern followed in editorderitems.ftl as there are examples for both?
>>> Vikas
>>> On May 27, 2009, at 9:57 PM, Adrian Crum wrote:
>>>> A simpler way to do this would be to use:
>>>>
>>>> <input size="6" type="text" name="price_${cartLineIndex}"
>>>> value="${price?string.currency}"/>
>>>>
>>>> -Adrian
>>>>
>>>> mor@apache.org wrote:
>>>>> Author: mor
>>>>> Date: Wed May 27 16:06:48 2009
>>>>> New Revision: 779221
>>>>> URL: http://svn.apache.org/viewvc?rev=779221&view=rev
>>>>> Log:
>>>>> Localized Unit Price input field in showcartitems.ftl. Patch from
>>>>> Mridul Pathak, part of OFBIZ-2530
>>>>> (https://issues.apache.org/jira/browse/OFBIZ-2530)
>>>>> Modified:
>>>>>  
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
>>>>>
>>>>> Modified:
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
>>>>>
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff
>>>>>
>>>>> ==============================================================================
>>>>>
>>>>> ---
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
>>>>> (original)
>>>>> +++
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
>>>>> Wed May 27 16:06:48 2009
>>>>> @@ -250,7 +250,7 @@
>>>>>                    <#else>
>>>>>                        <#assign price = cartLine.getBasePrice()>
>>>>>                    </#if>
>>>>> -                    <input size="6" type="text"
>>>>> name="price_${cartLineIndex}" value="${price}"/>
>>>>> +                    <input size="8" type="text"
>>>>> name="price_${cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
>>>>>                </#if>
>>>>>              </div>
>>>>>            </td>
> 
> 

-- 
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.


Re: svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Posted by Adrian Crum <ad...@hlmksw.com>.
Vikas,

I will let you decide. I don't know what the motivation was for making 
the change.

Freemarker knows the user's locale, so numbers should be formatted 
correctly. If you want a number formatted as currency, then you use the 
?string.currency built-in. The result should be currency formatted 
according to the user's locale.

I don't know if the ofbizAmount transform does something in addition to 
that.

Try it out and see.

-Adrian

Vikas Mayur wrote:
> Hi Adrian,
> 
> Thanks for the pointer. Do you think we should also change similar 
> pattern followed in editorderitems.ftl as there are examples for both?
> 
> Vikas
> 
> On May 27, 2009, at 9:57 PM, Adrian Crum wrote:
> 
>> A simpler way to do this would be to use:
>>
>> <input size="6" type="text" name="price_${cartLineIndex}" 
>> value="${price?string.currency}"/>
>>
>> -Adrian
>>
>> mor@apache.org wrote:
>>> Author: mor
>>> Date: Wed May 27 16:06:48 2009
>>> New Revision: 779221
>>> URL: http://svn.apache.org/viewvc?rev=779221&view=rev
>>> Log:
>>> Localized Unit Price input field in showcartitems.ftl. Patch from 
>>> Mridul Pathak, part of OFBIZ-2530 
>>> (https://issues.apache.org/jira/browse/OFBIZ-2530)
>>> Modified:
>>>    
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>>
>>> Modified: 
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>>
>>> URL: 
>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff 
>>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl 
>>> Wed May 27 16:06:48 2009
>>> @@ -250,7 +250,7 @@
>>>                     <#else>
>>>                         <#assign price = cartLine.getBasePrice()>
>>>                     </#if>
>>> -                    <input size="6" type="text" 
>>> name="price_${cartLineIndex}" value="${price}"/>
>>> +                    <input size="8" type="text" 
>>> name="price_${cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
>>>                 </#if>
>>>               </div>
>>>             </td>
> 

Re: svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Posted by Vikas Mayur <vi...@hotwaxmedia.com>.
Hi Adrian,

Thanks for the pointer. Do you think we should also change similar  
pattern followed in editorderitems.ftl as there are examples for both?

Vikas

On May 27, 2009, at 9:57 PM, Adrian Crum wrote:

> A simpler way to do this would be to use:
>
> <input size="6" type="text" name="price_${cartLineIndex}" value="$ 
> {price?string.currency}"/>
>
> -Adrian
>
> mor@apache.org wrote:
>> Author: mor
>> Date: Wed May 27 16:06:48 2009
>> New Revision: 779221
>> URL: http://svn.apache.org/viewvc?rev=779221&view=rev
>> Log:
>> Localized Unit Price input field in showcartitems.ftl. Patch from  
>> Mridul Pathak, part of OFBIZ-2530 (https://issues.apache.org/jira/browse/OFBIZ-2530 
>> )
>> Modified:
>>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>> showcartitems.ftl
>> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>> showcartitems.ftl
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>> showcartitems.ftl (original)
>> +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/ 
>> showcartitems.ftl Wed May 27 16:06:48 2009
>> @@ -250,7 +250,7 @@
>>                     <#else>
>>                         <#assign price = cartLine.getBasePrice()>
>>                     </#if>
>> -                    <input size="6" type="text" name="price_$ 
>> {cartLineIndex}" value="${price}"/>
>> +                    <input size="8" type="text" name="price_$ 
>> {cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
>>                 </#if>
>>               </div>
>>             </td>


Re: svn commit: r779221 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl

Posted by Adrian Crum <ad...@hlmksw.com>.
A simpler way to do this would be to use:

<input size="6" type="text" name="price_${cartLineIndex}" 
value="${price?string.currency}"/>

-Adrian

mor@apache.org wrote:
> Author: mor
> Date: Wed May 27 16:06:48 2009
> New Revision: 779221
> 
> URL: http://svn.apache.org/viewvc?rev=779221&view=rev
> Log:
> Localized Unit Price input field in showcartitems.ftl. Patch from Mridul Pathak, part of OFBIZ-2530 (https://issues.apache.org/jira/browse/OFBIZ-2530)
> 
> Modified:
>     ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
> 
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?rev=779221&r1=779220&r2=779221&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl Wed May 27 16:06:48 2009
> @@ -250,7 +250,7 @@
>                      <#else>
>                          <#assign price = cartLine.getBasePrice()>
>                      </#if>
> -                    <input size="6" type="text" name="price_${cartLineIndex}" value="${price}"/>
> +                    <input size="8" type="text" name="price_${cartLineIndex}" value="<@ofbizAmount amount=price/>"/>
>                  </#if>
>                </div>
>              </td>
> 
> 
>