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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Adrian Crum
A simpler way to do this would be to use:

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

-Adrian

[hidden email] 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>
>
>
>
Reply | Threaded
Open this post in threaded view
|

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

Vikas Mayur-3
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
>
> [hidden email] 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>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Adrian Crum
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
>>
>> [hidden email] 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>
>
Reply | Threaded
Open this post in threaded view
|

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

David E Jones-3

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
>>>
>>> [hidden email] 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>

Reply | Threaded
Open this post in threaded view
|

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

Adrian Crum
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
>>>>
>>>> [hidden email] 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>
>
>
Reply | Threaded
Open this post in threaded view
|

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

BJ Freeman
In reply to this post by Adrian Crum
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
>>>>
>>>> [hidden email] 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.