Help with a FTL if

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

Help with a FTL if

samhamilton
Hi,

Can someone help me with this if statement - i can only get it to return a value for long_description if one exists where as I want it to return a description if no long_description is found?

            <#assign prodDesc = productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
            <#if prodDesc?exists>
                ${productContentWrapper.get("LONG_DESCRIPTION")}
            <#else>
                ${productContentWrapper.get("DESCRIPTION")?if_exists}
            </#if>


Thanks
Sam


Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
Hi sam,

'exists' will check for existence of the variable.
'if_exists' will check for 'null' value.
if you want to check the value then use has_content.

I hope it will help you.

prasath
9442369696




On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:

> Hi,
>
> Can someone help me with this if statement - i can only get it to return a
> value for long_description if one exists where as I want it to return a
> description if no long_description is found?
>
>            <#assign prodDesc =
> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>            <#if prodDesc?exists>
>                ${productContentWrapper.get("LONG_DESCRIPTION")}
>            <#else>
>                ${productContentWrapper.get("DESCRIPTION")?if_exists}
>            </#if>
>
>
> Thanks
> Sam
>
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

samhamilton
Hi Prasath

Thanks for pointing that out so the revised code should look something like this so that if there is no content in description is uses long_description?

        <#if productContentWrapper.get("DESCRIPTION")?has_content>
            ${productContentWrapper.get("DESCRIPTION")}
            <#else>
            ${productContentWrapper.get("LONG_DESCRIPTION")}
         </#if>

Sam


On 20 Jun 2011, at 16:56, prasanth r wrote:

> Hi sam,
>
> 'exists' will check for existence of the variable.
> 'if_exists' will check for 'null' value.
> if you want to check the value then use has_content.
>
> I hope it will help you.
>
> prasath
> 9442369696
>
>
>
>
> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>
>> Hi,
>>
>> Can someone help me with this if statement - i can only get it to return a
>> value for long_description if one exists where as I want it to return a
>> description if no long_description is found?
>>
>>           <#assign prodDesc =
>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>           <#if prodDesc?exists>
>>               ${productContentWrapper.get("LONG_DESCRIPTION")}
>>           <#else>
>>               ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>           </#if>
>>
>>
>> Thanks
>> Sam
>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
sam,

 I hope we cannot use has_content with not existing variables. So, I suggest
to use 'exists' before has_content

#if productContentWrapper.get("DESCRIPTION")?exists?has_content>
                   ${productContentWrapper.get("DESCRIPTION")}
<#else>
 ${productContentWrapper.get("LONG_DESCRIPTION")}

> </#if>


best wishes
prasath.r
9442369696

On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:

> Hi Prasath
>
> Thanks for pointing that out so the revised code should look something like
> this so that if there is no content in description is uses long_description?
>
>        <#if productContentWrapper.get("DESCRIPTION")?has_content>
>            ${productContentWrapper.get("DESCRIPTION")}
>            <#else>
>            ${productContentWrapper.get("LONG_DESCRIPTION")}
>         </#if>
>
> Sam
>
>
> On 20 Jun 2011, at 16:56, prasanth r wrote:
>
> > Hi sam,
> >
> > 'exists' will check for existence of the variable.
> > 'if_exists' will check for 'null' value.
> > if you want to check the value then use has_content.
> >
> > I hope it will help you.
> >
> > prasath
> > 9442369696
> >
> >
> >
> >
> > On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> >
> >> Hi,
> >>
> >> Can someone help me with this if statement - i can only get it to return
> a
> >> value for long_description if one exists where as I want it to return a
> >> description if no long_description is found?
> >>
> >>           <#assign prodDesc =
> >> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> >>           <#if prodDesc?exists>
> >>               ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>           <#else>
> >>               ${productContentWrapper.get("DESCRIPTION")?if_exists}
> >>           </#if>
> >>
> >>
> >> Thanks
> >> Sam
> >>
> >>
> >>
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

samhamilton
Thanks for the help but that didn't work either!?

If the long_description is called first then where there is a long description on a product it shows the long description but does not show the description on products where there is no long description and only a description and most annoyingly if the description is called first then it shows description but not the long description on products that don't have a description but do have a long description.


Sam

On 20 Jun 2011, at 17:16, prasanth r wrote:

> sam,
>
> I hope we cannot use has_content with not existing variables. So, I suggest
> to use 'exists' before has_content
>
> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>                   ${productContentWrapper.get("DESCRIPTION")}
> <#else>
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
>> </#if>
>
>
> best wishes
> prasath.r
> 9442369696
>
> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>
>> Hi Prasath
>>
>> Thanks for pointing that out so the revised code should look something like
>> this so that if there is no content in description is uses long_description?
>>
>>       <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>           ${productContentWrapper.get("DESCRIPTION")}
>>           <#else>
>>           ${productContentWrapper.get("LONG_DESCRIPTION")}
>>        </#if>
>>
>> Sam
>>
>>
>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>
>>> Hi sam,
>>>
>>> 'exists' will check for existence of the variable.
>>> 'if_exists' will check for 'null' value.
>>> if you want to check the value then use has_content.
>>>
>>> I hope it will help you.
>>>
>>> prasath
>>> 9442369696
>>>
>>>
>>>
>>>
>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>
>>>> Hi,
>>>>
>>>> Can someone help me with this if statement - i can only get it to return
>> a
>>>> value for long_description if one exists where as I want it to return a
>>>> description if no long_description is found?
>>>>
>>>>          <#assign prodDesc =
>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>          <#if prodDesc?exists>
>>>>              ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>          <#else>
>>>>              ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>          </#if>
>>>>
>>>>
>>>> Thanks
>>>> Sam
>>>>
>>>>
>>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
sam,

check whether the values are coming correctly by printing

${productContentWrapper.get("DESCRIPTION")?if_exists}
than use with ?exists ?hascontent and see what it prints.

thanks
prasath. r

On Mon, Jun 20, 2011 at 3:10 PM, Sam Hamilton <[hidden email]> wrote:

> Thanks for the help but that didn't work either!?
>
> If the long_description is called first then where there is a long
> description on a product it shows the long description but does not show the
> description on products where there is no long description and only a
> description and most annoyingly if the description is called first then it
> shows description but not the long description on products that don't have a
> description but do have a long description.
>
>
> Sam
>
> On 20 Jun 2011, at 17:16, prasanth r wrote:
>
> > sam,
> >
> > I hope we cannot use has_content with not existing variables. So, I
> suggest
> > to use 'exists' before has_content
> >
> > #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
> >                   ${productContentWrapper.get("DESCRIPTION")}
> > <#else>
> > ${productContentWrapper.get("LONG_DESCRIPTION")}
> >
> >> </#if>
> >
> >
> > best wishes
> > prasath.r
> > 9442369696
> >
> > On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
> >
> >> Hi Prasath
> >>
> >> Thanks for pointing that out so the revised code should look something
> like
> >> this so that if there is no content in description is uses
> long_description?
> >>
> >>       <#if productContentWrapper.get("DESCRIPTION")?has_content>
> >>           ${productContentWrapper.get("DESCRIPTION")}
> >>           <#else>
> >>           ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>        </#if>
> >>
> >> Sam
> >>
> >>
> >> On 20 Jun 2011, at 16:56, prasanth r wrote:
> >>
> >>> Hi sam,
> >>>
> >>> 'exists' will check for existence of the variable.
> >>> 'if_exists' will check for 'null' value.
> >>> if you want to check the value then use has_content.
> >>>
> >>> I hope it will help you.
> >>>
> >>> prasath
> >>> 9442369696
> >>>
> >>>
> >>>
> >>>
> >>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Can someone help me with this if statement - i can only get it to
> return
> >> a
> >>>> value for long_description if one exists where as I want it to return
> a
> >>>> description if no long_description is found?
> >>>>
> >>>>          <#assign prodDesc =
> >>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> >>>>          <#if prodDesc?exists>
> >>>>              ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>          <#else>
> >>>>              ${productContentWrapper.get("DESCRIPTION")?if_exists}
> >>>>          </#if>
> >>>>
> >>>>
> >>>> Thanks
> >>>> Sam
> >>>>
> >>>>
> >>>>
> >>
> >>
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

Jacques Le Roux
Administrator
In reply to this post by samhamilton
${productContentWrapper.get("LONG_DESCRIPTION")!productContentWrapper.get("DESCRIPTION")!""}

Jacques


Jacques
Sam Hamilton wrote:

> Hi,
>
> Can someone help me with this if statement - i can only get it to return a value for long_description if one exists where as I
> want it to return a description if no long_description is found?
>
>            <#assign prodDesc = productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>            <#if prodDesc?exists>
>                ${productContentWrapper.get("LONG_DESCRIPTION")}
>            <#else>
>                ${productContentWrapper.get("DESCRIPTION")?if_exists}
>            </#if>
>
>
> Thanks
> Sam

Reply | Threaded
Open this post in threaded view
|

RE: Help with a FTL if

hardik handa
In reply to this post by samhamilton
<#if productContentWrapper.get("DESCRIPTION")?exists>

${productContentWrapper.get("DESCRIPTION")}

<#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
${productContentWrapper.get("LONG_DESCRIPTION")}

</#if>


This should do the trick

Regards,
Hardik Handa



-----Original Message-----
From: Sam Hamilton [mailto:[hidden email]]
Sent: Monday, June 20, 2011 3:10 PM
To: [hidden email]
Subject: Re: Help with a FTL if

Thanks for the help but that didn't work either!?

If the long_description is called first then where there is a long description on a product it shows the long description but does not show the description on products where there is no long description and only a description and most annoyingly if the description is called first then it shows description but not the long description on products that don't have a description but do have a long description.


Sam

On 20 Jun 2011, at 17:16, prasanth r wrote:

> sam,
>
> I hope we cannot use has_content with not existing variables. So, I suggest
> to use 'exists' before has_content
>
> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>                   ${productContentWrapper.get("DESCRIPTION")}
> <#else>
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
>> </#if>
>
>
> best wishes
> prasath.r
> 9442369696
>
> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>
>> Hi Prasath
>>
>> Thanks for pointing that out so the revised code should look something like
>> this so that if there is no content in description is uses long_description?
>>
>>       <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>           ${productContentWrapper.get("DESCRIPTION")}
>>           <#else>
>>           ${productContentWrapper.get("LONG_DESCRIPTION")}
>>        </#if>
>>
>> Sam
>>
>>
>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>
>>> Hi sam,
>>>
>>> 'exists' will check for existence of the variable.
>>> 'if_exists' will check for 'null' value.
>>> if you want to check the value then use has_content.
>>>
>>> I hope it will help you.
>>>
>>> prasath
>>> 9442369696
>>>
>>>
>>>
>>>
>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>
>>>> Hi,
>>>>
>>>> Can someone help me with this if statement - i can only get it to return
>> a
>>>> value for long_description if one exists where as I want it to return a
>>>> description if no long_description is found?
>>>>
>>>>          <#assign prodDesc =
>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>          <#if prodDesc?exists>
>>>>              ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>          <#else>
>>>>              ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>          </#if>
>>>>
>>>>
>>>> Thanks
>>>> Sam
>>>>
>>>>
>>>>
>>
>>


::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
In reply to this post by Jacques Le Roux
what does it mean.


On Mon, Jun 20, 2011 at 3:20 PM, Jacques Le Roux <
[hidden email]> wrote:

> ${productContentWrapper.get("**LONG_DESCRIPTION")!**
> productContentWrapper.get("**DESCRIPTION")!""}
>
> Jacques
>
>
> Jacques
>
> Sam Hamilton wrote:
>
>> Hi,
>>
>> Can someone help me with this if statement - i can only get it to return a
>> value for long_description if one exists where as I
>> want it to return a description if no long_description is found?
>>           <#assign prodDesc = productContentWrapper.get("**
>> LONG_DESCRIPTION")?if_exists>
>>           <#if prodDesc?exists>
>>               ${productContentWrapper.get("**LONG_DESCRIPTION")}
>>           <#else>
>>               ${productContentWrapper.get("**DESCRIPTION")?if_exists}
>>           </#if>
>>
>>
>> Thanks
>> Sam
>>
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
In reply to this post by hardik handa
hardick,

exists will only check for existance of the variable. is it?

thanks
prasath. r

On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]> wrote:

> <#if productContentWrapper.get("DESCRIPTION")?exists>
>
> ${productContentWrapper.get("DESCRIPTION")}
>
> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> </#if>
>
>
> This should do the trick
>
> Regards,
> Hardik Handa
>
>
>
> -----Original Message-----
> From: Sam Hamilton [mailto:[hidden email]]
> Sent: Monday, June 20, 2011 3:10 PM
> To: [hidden email]
> Subject: Re: Help with a FTL if
>
> Thanks for the help but that didn't work either!?
>
> If the long_description is called first then where there is a long
> description on a product it shows the long description but does not show the
> description on products where there is no long description and only a
> description and most annoyingly if the description is called first then it
> shows description but not the long description on products that don't have a
> description but do have a long description.
>
>
> Sam
>
> On 20 Jun 2011, at 17:16, prasanth r wrote:
>
> > sam,
> >
> > I hope we cannot use has_content with not existing variables. So, I
> suggest
> > to use 'exists' before has_content
> >
> > #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
> >                   ${productContentWrapper.get("DESCRIPTION")}
> > <#else>
> > ${productContentWrapper.get("LONG_DESCRIPTION")}
> >
> >> </#if>
> >
> >
> > best wishes
> > prasath.r
> > 9442369696
> >
> > On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
> >
> >> Hi Prasath
> >>
> >> Thanks for pointing that out so the revised code should look something
> like
> >> this so that if there is no content in description is uses
> long_description?
> >>
> >>       <#if productContentWrapper.get("DESCRIPTION")?has_content>
> >>           ${productContentWrapper.get("DESCRIPTION")}
> >>           <#else>
> >>           ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>        </#if>
> >>
> >> Sam
> >>
> >>
> >> On 20 Jun 2011, at 16:56, prasanth r wrote:
> >>
> >>> Hi sam,
> >>>
> >>> 'exists' will check for existence of the variable.
> >>> 'if_exists' will check for 'null' value.
> >>> if you want to check the value then use has_content.
> >>>
> >>> I hope it will help you.
> >>>
> >>> prasath
> >>> 9442369696
> >>>
> >>>
> >>>
> >>>
> >>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Can someone help me with this if statement - i can only get it to
> return
> >> a
> >>>> value for long_description if one exists where as I want it to return
> a
> >>>> description if no long_description is found?
> >>>>
> >>>>          <#assign prodDesc =
> >>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> >>>>          <#if prodDesc?exists>
> >>>>              ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>          <#else>
> >>>>              ${productContentWrapper.get("DESCRIPTION")?if_exists}
> >>>>          </#if>
> >>>>
> >>>>
> >>>> Thanks
> >>>> Sam
> >>>>
> >>>>
> >>>>
> >>
> >>
>
>
> ::DISCLAIMER::
>
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its
> affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect
> the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and / or publication of
> this message without the prior written consent of the author of this e-mail
> is strictly prohibited. If you have
> received this email in error please delete it and notify the sender
> immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
>
> -----------------------------------------------------------------------------------------------------------------------
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

RE: Help with a FTL if

hardik handa
Prasath,
It's Hardik not hardick my friend lol


Yes u are pretty right about that, all I wanted to see if he even gets an error referring to a null value.
If he gets that we could then get an extra check on null value too.

-----Original Message-----
From: prasanth r [mailto:[hidden email]]
Sent: Monday, June 20, 2011 3:25 PM
To: [hidden email]
Subject: Re: Help with a FTL if

hardick,

exists will only check for existance of the variable. is it?

thanks
prasath. r

On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]> wrote:

> <#if productContentWrapper.get("DESCRIPTION")?exists>
>
> ${productContentWrapper.get("DESCRIPTION")}
>
> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> </#if>
>
>
> This should do the trick
>
> Regards,
> Hardik Handa
>
>
>
> -----Original Message-----
> From: Sam Hamilton [mailto:[hidden email]]
> Sent: Monday, June 20, 2011 3:10 PM
> To: [hidden email]
> Subject: Re: Help with a FTL if
>
> Thanks for the help but that didn't work either!?
>
> If the long_description is called first then where there is a long
> description on a product it shows the long description but does not show the
> description on products where there is no long description and only a
> description and most annoyingly if the description is called first then it
> shows description but not the long description on products that don't have a
> description but do have a long description.
>
>
> Sam
>
> On 20 Jun 2011, at 17:16, prasanth r wrote:
>
> > sam,
> >
> > I hope we cannot use has_content with not existing variables. So, I
> suggest
> > to use 'exists' before has_content
> >
> > #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
> >                   ${productContentWrapper.get("DESCRIPTION")}
> > <#else>
> > ${productContentWrapper.get("LONG_DESCRIPTION")}
> >
> >> </#if>
> >
> >
> > best wishes
> > prasath.r
> > 9442369696
> >
> > On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
> >
> >> Hi Prasath
> >>
> >> Thanks for pointing that out so the revised code should look something
> like
> >> this so that if there is no content in description is uses
> long_description?
> >>
> >>       <#if productContentWrapper.get("DESCRIPTION")?has_content>
> >>           ${productContentWrapper.get("DESCRIPTION")}
> >>           <#else>
> >>           ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>        </#if>
> >>
> >> Sam
> >>
> >>
> >> On 20 Jun 2011, at 16:56, prasanth r wrote:
> >>
> >>> Hi sam,
> >>>
> >>> 'exists' will check for existence of the variable.
> >>> 'if_exists' will check for 'null' value.
> >>> if you want to check the value then use has_content.
> >>>
> >>> I hope it will help you.
> >>>
> >>> prasath
> >>> 9442369696
> >>>
> >>>
> >>>
> >>>
> >>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Can someone help me with this if statement - i can only get it to
> return
> >> a
> >>>> value for long_description if one exists where as I want it to return
> a
> >>>> description if no long_description is found?
> >>>>
> >>>>          <#assign prodDesc =
> >>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> >>>>          <#if prodDesc?exists>
> >>>>              ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>          <#else>
> >>>>              ${productContentWrapper.get("DESCRIPTION")?if_exists}
> >>>>          </#if>
> >>>>
> >>>>
> >>>> Thanks
> >>>> Sam
> >>>>
> >>>>
> >>>>
> >>
> >>
>
>
> ::DISCLAIMER::
>
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its
> affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect
> the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and / or publication of
> this message without the prior written consent of the author of this e-mail
> is strictly prohibited. If you have
> received this email in error please delete it and notify the sender
> immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
>
> -----------------------------------------------------------------------------------------------------------------------
>
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
Hardik & sam,

for null check we can use if_exists  or has_content also right.

thanks
prasath. r


On Mon, Jun 20, 2011 at 3:28 PM, Hardik Handa <[hidden email]> wrote:

> Prasath,
> It's Hardik not hardick my friend lol
>
>
> Yes u are pretty right about that, all I wanted to see if he even gets an
> error referring to a null value.
> If he gets that we could then get an extra check on null value too.
>
> -----Original Message-----
> From: prasanth r [mailto:[hidden email]]
> Sent: Monday, June 20, 2011 3:25 PM
> To: [hidden email]
> Subject: Re: Help with a FTL if
>
> hardick,
>
> exists will only check for existance of the variable. is it?
>
> thanks
> prasath. r
>
> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]>
> wrote:
>
> > <#if productContentWrapper.get("DESCRIPTION")?exists>
> >
> > ${productContentWrapper.get("DESCRIPTION")}
> >
> > <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
> > ${productContentWrapper.get("LONG_DESCRIPTION")}
> >
> > </#if>
> >
> >
> > This should do the trick
> >
> > Regards,
> > Hardik Handa
> >
> >
> >
> > -----Original Message-----
> > From: Sam Hamilton [mailto:[hidden email]]
> > Sent: Monday, June 20, 2011 3:10 PM
> > To: [hidden email]
> > Subject: Re: Help with a FTL if
> >
> > Thanks for the help but that didn't work either!?
> >
> > If the long_description is called first then where there is a long
> > description on a product it shows the long description but does not show
> the
> > description on products where there is no long description and only a
> > description and most annoyingly if the description is called first then
> it
> > shows description but not the long description on products that don't
> have a
> > description but do have a long description.
> >
> >
> > Sam
> >
> > On 20 Jun 2011, at 17:16, prasanth r wrote:
> >
> > > sam,
> > >
> > > I hope we cannot use has_content with not existing variables. So, I
> > suggest
> > > to use 'exists' before has_content
> > >
> > > #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
> > >                   ${productContentWrapper.get("DESCRIPTION")}
> > > <#else>
> > > ${productContentWrapper.get("LONG_DESCRIPTION")}
> > >
> > >> </#if>
> > >
> > >
> > > best wishes
> > > prasath.r
> > > 9442369696
> > >
> > > On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
> > >
> > >> Hi Prasath
> > >>
> > >> Thanks for pointing that out so the revised code should look something
> > like
> > >> this so that if there is no content in description is uses
> > long_description?
> > >>
> > >>       <#if productContentWrapper.get("DESCRIPTION")?has_content>
> > >>           ${productContentWrapper.get("DESCRIPTION")}
> > >>           <#else>
> > >>           ${productContentWrapper.get("LONG_DESCRIPTION")}
> > >>        </#if>
> > >>
> > >> Sam
> > >>
> > >>
> > >> On 20 Jun 2011, at 16:56, prasanth r wrote:
> > >>
> > >>> Hi sam,
> > >>>
> > >>> 'exists' will check for existence of the variable.
> > >>> 'if_exists' will check for 'null' value.
> > >>> if you want to check the value then use has_content.
> > >>>
> > >>> I hope it will help you.
> > >>>
> > >>> prasath
> > >>> 9442369696
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> > >>>
> > >>>> Hi,
> > >>>>
> > >>>> Can someone help me with this if statement - i can only get it to
> > return
> > >> a
> > >>>> value for long_description if one exists where as I want it to
> return
> > a
> > >>>> description if no long_description is found?
> > >>>>
> > >>>>          <#assign prodDesc =
> > >>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> > >>>>          <#if prodDesc?exists>
> > >>>>              ${productContentWrapper.get("LONG_DESCRIPTION")}
> > >>>>          <#else>
> > >>>>              ${productContentWrapper.get("DESCRIPTION")?if_exists}
> > >>>>          </#if>
> > >>>>
> > >>>>
> > >>>> Thanks
> > >>>> Sam
> > >>>>
> > >>>>
> > >>>>
> > >>
> > >>
> >
> >
> > ::DISCLAIMER::
> >
> >
> -----------------------------------------------------------------------------------------------------------------------
> >
> > The contents of this e-mail and any attachment(s) are confidential and
> > intended for the named recipient(s) only.
> > It shall not attach any liability on the originator or HCL or its
> > affiliates. Any views or opinions presented in
> > this email are solely those of the author and may not necessarily reflect
> > the opinions of HCL or its affiliates.
> > Any form of reproduction, dissemination, copying, disclosure,
> modification,
> > distribution and / or publication of
> > this message without the prior written consent of the author of this
> e-mail
> > is strictly prohibited. If you have
> > received this email in error please delete it and notify the sender
> > immediately. Before opening any mail and
> > attachments please check them for viruses and defect.
> >
> >
> >
> -----------------------------------------------------------------------------------------------------------------------
> >
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

samhamilton
In reply to this post by prasath
Hi Hardik and Jacques - tried both that and also does not work.

So far the only solution would be to hope that one product does not have both a description and a long_description and use:
${productContentWrapper.get("DESCRIPTION")}
${productContentWrapper.get("LONG_DESCRIPTION")}

Very fustrating!

Sam


On 20 Jun 2011, at 17:54, prasanth r wrote:

> hardick,
>
> exists will only check for existance of the variable. is it?
>
> thanks
> prasath. r
>
> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]> wrote:
>
>> <#if productContentWrapper.get("DESCRIPTION")?exists>
>>
>> ${productContentWrapper.get("DESCRIPTION")}
>>
>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>
>> </#if>
>>
>>
>> This should do the trick
>>
>> Regards,
>> Hardik Handa
>>
>>
>>
>> -----Original Message-----
>> From: Sam Hamilton [mailto:[hidden email]]
>> Sent: Monday, June 20, 2011 3:10 PM
>> To: [hidden email]
>> Subject: Re: Help with a FTL if
>>
>> Thanks for the help but that didn't work either!?
>>
>> If the long_description is called first then where there is a long
>> description on a product it shows the long description but does not show the
>> description on products where there is no long description and only a
>> description and most annoyingly if the description is called first then it
>> shows description but not the long description on products that don't have a
>> description but do have a long description.
>>
>>
>> Sam
>>
>> On 20 Jun 2011, at 17:16, prasanth r wrote:
>>
>>> sam,
>>>
>>> I hope we cannot use has_content with not existing variables. So, I
>> suggest
>>> to use 'exists' before has_content
>>>
>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>>>                  ${productContentWrapper.get("DESCRIPTION")}
>>> <#else>
>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>
>>>> </#if>
>>>
>>>
>>> best wishes
>>> prasath.r
>>> 9442369696
>>>
>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>>>
>>>> Hi Prasath
>>>>
>>>> Thanks for pointing that out so the revised code should look something
>> like
>>>> this so that if there is no content in description is uses
>> long_description?
>>>>
>>>>      <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>>>          ${productContentWrapper.get("DESCRIPTION")}
>>>>          <#else>
>>>>          ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>       </#if>
>>>>
>>>> Sam
>>>>
>>>>
>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>>>
>>>>> Hi sam,
>>>>>
>>>>> 'exists' will check for existence of the variable.
>>>>> 'if_exists' will check for 'null' value.
>>>>> if you want to check the value then use has_content.
>>>>>
>>>>> I hope it will help you.
>>>>>
>>>>> prasath
>>>>> 9442369696
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Can someone help me with this if statement - i can only get it to
>> return
>>>> a
>>>>>> value for long_description if one exists where as I want it to return
>> a
>>>>>> description if no long_description is found?
>>>>>>
>>>>>>         <#assign prodDesc =
>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>>>         <#if prodDesc?exists>
>>>>>>             ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>         <#else>
>>>>>>             ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>>>         </#if>
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> Sam
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
>> ::DISCLAIMER::
>>
>> -----------------------------------------------------------------------------------------------------------------------
>>
>> The contents of this e-mail and any attachment(s) are confidential and
>> intended for the named recipient(s) only.
>> It shall not attach any liability on the originator or HCL or its
>> affiliates. Any views or opinions presented in
>> this email are solely those of the author and may not necessarily reflect
>> the opinions of HCL or its affiliates.
>> Any form of reproduction, dissemination, copying, disclosure, modification,
>> distribution and / or publication of
>> this message without the prior written consent of the author of this e-mail
>> is strictly prohibited. If you have
>> received this email in error please delete it and notify the sender
>> immediately. Before opening any mail and
>> attachments please check them for viruses and defect.
>>
>>
>> -----------------------------------------------------------------------------------------------------------------------
>>

Reply | Threaded
Open this post in threaded view
|

RE: Help with a FTL if

hardik handa
Sam,

Wat does it print when u use the code lines I provided ???
It would be of help to me to figure out the actual problem

-----Original Message-----
From: Sam Hamilton [mailto:[hidden email]]
Sent: Monday, June 20, 2011 3:31 PM
To: [hidden email]
Subject: Re: Help with a FTL if

Hi Hardik and Jacques - tried both that and also does not work.

So far the only solution would be to hope that one product does not have both a description and a long_description and use:
${productContentWrapper.get("DESCRIPTION")}
${productContentWrapper.get("LONG_DESCRIPTION")}

Very fustrating!

Sam


On 20 Jun 2011, at 17:54, prasanth r wrote:

> hardick,
>
> exists will only check for existance of the variable. is it?
>
> thanks
> prasath. r
>
> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]> wrote:
>
>> <#if productContentWrapper.get("DESCRIPTION")?exists>
>>
>> ${productContentWrapper.get("DESCRIPTION")}
>>
>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>
>> </#if>
>>
>>
>> This should do the trick
>>
>> Regards,
>> Hardik Handa
>>
>>
>>
>> -----Original Message-----
>> From: Sam Hamilton [mailto:[hidden email]]
>> Sent: Monday, June 20, 2011 3:10 PM
>> To: [hidden email]
>> Subject: Re: Help with a FTL if
>>
>> Thanks for the help but that didn't work either!?
>>
>> If the long_description is called first then where there is a long
>> description on a product it shows the long description but does not show the
>> description on products where there is no long description and only a
>> description and most annoyingly if the description is called first then it
>> shows description but not the long description on products that don't have a
>> description but do have a long description.
>>
>>
>> Sam
>>
>> On 20 Jun 2011, at 17:16, prasanth r wrote:
>>
>>> sam,
>>>
>>> I hope we cannot use has_content with not existing variables. So, I
>> suggest
>>> to use 'exists' before has_content
>>>
>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>>>                  ${productContentWrapper.get("DESCRIPTION")}
>>> <#else>
>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>
>>>> </#if>
>>>
>>>
>>> best wishes
>>> prasath.r
>>> 9442369696
>>>
>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>>>
>>>> Hi Prasath
>>>>
>>>> Thanks for pointing that out so the revised code should look something
>> like
>>>> this so that if there is no content in description is uses
>> long_description?
>>>>
>>>>      <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>>>          ${productContentWrapper.get("DESCRIPTION")}
>>>>          <#else>
>>>>          ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>       </#if>
>>>>
>>>> Sam
>>>>
>>>>
>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>>>
>>>>> Hi sam,
>>>>>
>>>>> 'exists' will check for existence of the variable.
>>>>> 'if_exists' will check for 'null' value.
>>>>> if you want to check the value then use has_content.
>>>>>
>>>>> I hope it will help you.
>>>>>
>>>>> prasath
>>>>> 9442369696
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Can someone help me with this if statement - i can only get it to
>> return
>>>> a
>>>>>> value for long_description if one exists where as I want it to return
>> a
>>>>>> description if no long_description is found?
>>>>>>
>>>>>>         <#assign prodDesc =
>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>>>         <#if prodDesc?exists>
>>>>>>             ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>         <#else>
>>>>>>             ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>>>         </#if>
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> Sam
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
>> ::DISCLAIMER::
>>
>> -----------------------------------------------------------------------------------------------------------------------
>>
>> The contents of this e-mail and any attachment(s) are confidential and
>> intended for the named recipient(s) only.
>> It shall not attach any liability on the originator or HCL or its
>> affiliates. Any views or opinions presented in
>> this email are solely those of the author and may not necessarily reflect
>> the opinions of HCL or its affiliates.
>> Any form of reproduction, dissemination, copying, disclosure, modification,
>> distribution and / or publication of
>> this message without the prior written consent of the author of this e-mail
>> is strictly prohibited. If you have
>> received this email in error please delete it and notify the sender
>> immediately. Before opening any mail and
>> attachments please check them for viruses and defect.
>>
>>
>> -----------------------------------------------------------------------------------------------------------------------
>>

Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
sam,

print whole map like this ${productContentWrapper}

and post the result then it will be helpful to all
thanks
prasath



On Mon, Jun 20, 2011 at 3:33 PM, Hardik Handa <[hidden email]> wrote:

> Sam,
>
> Wat does it print when u use the code lines I provided ???
> It would be of help to me to figure out the actual problem
>
> -----Original Message-----
> From: Sam Hamilton [mailto:[hidden email]]
> Sent: Monday, June 20, 2011 3:31 PM
> To: [hidden email]
> Subject: Re: Help with a FTL if
>
> Hi Hardik and Jacques - tried both that and also does not work.
>
> So far the only solution would be to hope that one product does not have
> both a description and a long_description and use:
> ${productContentWrapper.get("DESCRIPTION")}
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> Very fustrating!
>
> Sam
>
>
> On 20 Jun 2011, at 17:54, prasanth r wrote:
>
> > hardick,
> >
> > exists will only check for existance of the variable. is it?
> >
> > thanks
> > prasath. r
> >
> > On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]>
> wrote:
> >
> >> <#if productContentWrapper.get("DESCRIPTION")?exists>
> >>
> >> ${productContentWrapper.get("DESCRIPTION")}
> >>
> >> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
> >> ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>
> >> </#if>
> >>
> >>
> >> This should do the trick
> >>
> >> Regards,
> >> Hardik Handa
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: Sam Hamilton [mailto:[hidden email]]
> >> Sent: Monday, June 20, 2011 3:10 PM
> >> To: [hidden email]
> >> Subject: Re: Help with a FTL if
> >>
> >> Thanks for the help but that didn't work either!?
> >>
> >> If the long_description is called first then where there is a long
> >> description on a product it shows the long description but does not show
> the
> >> description on products where there is no long description and only a
> >> description and most annoyingly if the description is called first then
> it
> >> shows description but not the long description on products that don't
> have a
> >> description but do have a long description.
> >>
> >>
> >> Sam
> >>
> >> On 20 Jun 2011, at 17:16, prasanth r wrote:
> >>
> >>> sam,
> >>>
> >>> I hope we cannot use has_content with not existing variables. So, I
> >> suggest
> >>> to use 'exists' before has_content
> >>>
> >>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
> >>>                  ${productContentWrapper.get("DESCRIPTION")}
> >>> <#else>
> >>> ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>
> >>>> </#if>
> >>>
> >>>
> >>> best wishes
> >>> prasath.r
> >>> 9442369696
> >>>
> >>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
> >>>
> >>>> Hi Prasath
> >>>>
> >>>> Thanks for pointing that out so the revised code should look something
> >> like
> >>>> this so that if there is no content in description is uses
> >> long_description?
> >>>>
> >>>>      <#if productContentWrapper.get("DESCRIPTION")?has_content>
> >>>>          ${productContentWrapper.get("DESCRIPTION")}
> >>>>          <#else>
> >>>>          ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>       </#if>
> >>>>
> >>>> Sam
> >>>>
> >>>>
> >>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
> >>>>
> >>>>> Hi sam,
> >>>>>
> >>>>> 'exists' will check for existence of the variable.
> >>>>> 'if_exists' will check for 'null' value.
> >>>>> if you want to check the value then use has_content.
> >>>>>
> >>>>> I hope it will help you.
> >>>>>
> >>>>> prasath
> >>>>> 9442369696
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> Can someone help me with this if statement - i can only get it to
> >> return
> >>>> a
> >>>>>> value for long_description if one exists where as I want it to
> return
> >> a
> >>>>>> description if no long_description is found?
> >>>>>>
> >>>>>>         <#assign prodDesc =
> >>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> >>>>>>         <#if prodDesc?exists>
> >>>>>>             ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>>>         <#else>
> >>>>>>             ${productContentWrapper.get("DESCRIPTION")?if_exists}
> >>>>>>         </#if>
> >>>>>>
> >>>>>>
> >>>>>> Thanks
> >>>>>> Sam
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
> >> ::DISCLAIMER::
> >>
> >>
> -----------------------------------------------------------------------------------------------------------------------
> >>
> >> The contents of this e-mail and any attachment(s) are confidential and
> >> intended for the named recipient(s) only.
> >> It shall not attach any liability on the originator or HCL or its
> >> affiliates. Any views or opinions presented in
> >> this email are solely those of the author and may not necessarily
> reflect
> >> the opinions of HCL or its affiliates.
> >> Any form of reproduction, dissemination, copying, disclosure,
> modification,
> >> distribution and / or publication of
> >> this message without the prior written consent of the author of this
> e-mail
> >> is strictly prohibited. If you have
> >> received this email in error please delete it and notify the sender
> >> immediately. Before opening any mail and
> >> attachments please check them for viruses and defect.
> >>
> >>
> >>
> -----------------------------------------------------------------------------------------------------------------------
> >>
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

samhamilton
In reply to this post by hardik handa
Hi,

All the examples including yours seem to work like this
if the code snippet checked for the description first then
If product A has a description then it shows a description
If product B has a long_description then it shows nothing.

If you then swap the code so that it checks for long_description first then
If product A has a description then it shows nothing
If product B has a long_description then it shows the long_description.

${productContentWrapper} just shows org.ofbiz.product.product.ProductContentWrapper@6ec0ac92

Thanks
Sam


On 20 Jun 2011, at 18:03, Hardik Handa wrote:

> Sam,
>
> Wat does it print when u use the code lines I provided ???
> It would be of help to me to figure out the actual problem
>
> -----Original Message-----
> From: Sam Hamilton [mailto:[hidden email]]
> Sent: Monday, June 20, 2011 3:31 PM
> To: [hidden email]
> Subject: Re: Help with a FTL if
>
> Hi Hardik and Jacques - tried both that and also does not work.
>
> So far the only solution would be to hope that one product does not have both a description and a long_description and use:
> ${productContentWrapper.get("DESCRIPTION")}
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> Very fustrating!
>
> Sam
>
>
> On 20 Jun 2011, at 17:54, prasanth r wrote:
>
>> hardick,
>>
>> exists will only check for existance of the variable. is it?
>>
>> thanks
>> prasath. r
>>
>> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]> wrote:
>>
>>> <#if productContentWrapper.get("DESCRIPTION")?exists>
>>>
>>> ${productContentWrapper.get("DESCRIPTION")}
>>>
>>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>
>>> </#if>
>>>
>>>
>>> This should do the trick
>>>
>>> Regards,
>>> Hardik Handa
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Sam Hamilton [mailto:[hidden email]]
>>> Sent: Monday, June 20, 2011 3:10 PM
>>> To: [hidden email]
>>> Subject: Re: Help with a FTL if
>>>
>>> Thanks for the help but that didn't work either!?
>>>
>>> If the long_description is called first then where there is a long
>>> description on a product it shows the long description but does not show the
>>> description on products where there is no long description and only a
>>> description and most annoyingly if the description is called first then it
>>> shows description but not the long description on products that don't have a
>>> description but do have a long description.
>>>
>>>
>>> Sam
>>>
>>> On 20 Jun 2011, at 17:16, prasanth r wrote:
>>>
>>>> sam,
>>>>
>>>> I hope we cannot use has_content with not existing variables. So, I
>>> suggest
>>>> to use 'exists' before has_content
>>>>
>>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>>>>                 ${productContentWrapper.get("DESCRIPTION")}
>>>> <#else>
>>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>
>>>>> </#if>
>>>>
>>>>
>>>> best wishes
>>>> prasath.r
>>>> 9442369696
>>>>
>>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>>>>
>>>>> Hi Prasath
>>>>>
>>>>> Thanks for pointing that out so the revised code should look something
>>> like
>>>>> this so that if there is no content in description is uses
>>> long_description?
>>>>>
>>>>>     <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>>>>         ${productContentWrapper.get("DESCRIPTION")}
>>>>>         <#else>
>>>>>         ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>      </#if>
>>>>>
>>>>> Sam
>>>>>
>>>>>
>>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>>>>
>>>>>> Hi sam,
>>>>>>
>>>>>> 'exists' will check for existence of the variable.
>>>>>> 'if_exists' will check for 'null' value.
>>>>>> if you want to check the value then use has_content.
>>>>>>
>>>>>> I hope it will help you.
>>>>>>
>>>>>> prasath
>>>>>> 9442369696
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Can someone help me with this if statement - i can only get it to
>>> return
>>>>> a
>>>>>>> value for long_description if one exists where as I want it to return
>>> a
>>>>>>> description if no long_description is found?
>>>>>>>
>>>>>>>        <#assign prodDesc =
>>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>>>>        <#if prodDesc?exists>
>>>>>>>            ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>>        <#else>
>>>>>>>            ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>>>>        </#if>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> Sam
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>>> ::DISCLAIMER::
>>>
>>> -----------------------------------------------------------------------------------------------------------------------
>>>
>>> The contents of this e-mail and any attachment(s) are confidential and
>>> intended for the named recipient(s) only.
>>> It shall not attach any liability on the originator or HCL or its
>>> affiliates. Any views or opinions presented in
>>> this email are solely those of the author and may not necessarily reflect
>>> the opinions of HCL or its affiliates.
>>> Any form of reproduction, dissemination, copying, disclosure, modification,
>>> distribution and / or publication of
>>> this message without the prior written consent of the author of this e-mail
>>> is strictly prohibited. If you have
>>> received this email in error please delete it and notify the sender
>>> immediately. Before opening any mail and
>>> attachments please check them for viruses and defect.
>>>
>>>
>>> -----------------------------------------------------------------------------------------------------------------------
>>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

prasath
Sam,
Print and see,
====> ${productContentWrapper.get("DESCRIPTION")}

====> ${productContentWrapper.get("LONG_DESCRIPTION")}

post the output too.
thanks
prasath. r

On Mon, Jun 20, 2011 at 3:42 PM, Sam Hamilton <[hidden email]> wrote:

> Hi,
>
> All the examples including yours seem to work like this
> if the code snippet checked for the description first then
> If product A has a description then it shows a description
> If product B has a long_description then it shows nothing.
>
> If you then swap the code so that it checks for long_description first then
> If product A has a description then it shows nothing
> If product B has a long_description then it shows the long_description.
>
> ${productContentWrapper} just shows
> org.ofbiz.product.product.ProductContentWrapper@6ec0ac92
>
> Thanks
> Sam
>
>
> On 20 Jun 2011, at 18:03, Hardik Handa wrote:
>
> > Sam,
> >
> > Wat does it print when u use the code lines I provided ???
> > It would be of help to me to figure out the actual problem
> >
> > -----Original Message-----
> > From: Sam Hamilton [mailto:[hidden email]]
> > Sent: Monday, June 20, 2011 3:31 PM
> > To: [hidden email]
> > Subject: Re: Help with a FTL if
> >
> > Hi Hardik and Jacques - tried both that and also does not work.
> >
> > So far the only solution would be to hope that one product does not have
> both a description and a long_description and use:
> > ${productContentWrapper.get("DESCRIPTION")}
> > ${productContentWrapper.get("LONG_DESCRIPTION")}
> >
> > Very fustrating!
> >
> > Sam
> >
> >
> > On 20 Jun 2011, at 17:54, prasanth r wrote:
> >
> >> hardick,
> >>
> >> exists will only check for existance of the variable. is it?
> >>
> >> thanks
> >> prasath. r
> >>
> >> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]>
> wrote:
> >>
> >>> <#if productContentWrapper.get("DESCRIPTION")?exists>
> >>>
> >>> ${productContentWrapper.get("DESCRIPTION")}
> >>>
> >>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
> >>> ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>
> >>> </#if>
> >>>
> >>>
> >>> This should do the trick
> >>>
> >>> Regards,
> >>> Hardik Handa
> >>>
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: Sam Hamilton [mailto:[hidden email]]
> >>> Sent: Monday, June 20, 2011 3:10 PM
> >>> To: [hidden email]
> >>> Subject: Re: Help with a FTL if
> >>>
> >>> Thanks for the help but that didn't work either!?
> >>>
> >>> If the long_description is called first then where there is a long
> >>> description on a product it shows the long description but does not
> show the
> >>> description on products where there is no long description and only a
> >>> description and most annoyingly if the description is called first then
> it
> >>> shows description but not the long description on products that don't
> have a
> >>> description but do have a long description.
> >>>
> >>>
> >>> Sam
> >>>
> >>> On 20 Jun 2011, at 17:16, prasanth r wrote:
> >>>
> >>>> sam,
> >>>>
> >>>> I hope we cannot use has_content with not existing variables. So, I
> >>> suggest
> >>>> to use 'exists' before has_content
> >>>>
> >>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
> >>>>                 ${productContentWrapper.get("DESCRIPTION")}
> >>>> <#else>
> >>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>
> >>>>> </#if>
> >>>>
> >>>>
> >>>> best wishes
> >>>> prasath.r
> >>>> 9442369696
> >>>>
> >>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
> >>>>
> >>>>> Hi Prasath
> >>>>>
> >>>>> Thanks for pointing that out so the revised code should look
> something
> >>> like
> >>>>> this so that if there is no content in description is uses
> >>> long_description?
> >>>>>
> >>>>>     <#if productContentWrapper.get("DESCRIPTION")?has_content>
> >>>>>         ${productContentWrapper.get("DESCRIPTION")}
> >>>>>         <#else>
> >>>>>         ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>>      </#if>
> >>>>>
> >>>>> Sam
> >>>>>
> >>>>>
> >>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
> >>>>>
> >>>>>> Hi sam,
> >>>>>>
> >>>>>> 'exists' will check for existence of the variable.
> >>>>>> 'if_exists' will check for 'null' value.
> >>>>>> if you want to check the value then use has_content.
> >>>>>>
> >>>>>> I hope it will help you.
> >>>>>>
> >>>>>> prasath
> >>>>>> 9442369696
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> Can someone help me with this if statement - i can only get it to
> >>> return
> >>>>> a
> >>>>>>> value for long_description if one exists where as I want it to
> return
> >>> a
> >>>>>>> description if no long_description is found?
> >>>>>>>
> >>>>>>>        <#assign prodDesc =
> >>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
> >>>>>>>        <#if prodDesc?exists>
> >>>>>>>            ${productContentWrapper.get("LONG_DESCRIPTION")}
> >>>>>>>        <#else>
> >>>>>>>            ${productContentWrapper.get("DESCRIPTION")?if_exists}
> >>>>>>>        </#if>
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>> Sam
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>> ::DISCLAIMER::
> >>>
> >>>
> -----------------------------------------------------------------------------------------------------------------------
> >>>
> >>> The contents of this e-mail and any attachment(s) are confidential and
> >>> intended for the named recipient(s) only.
> >>> It shall not attach any liability on the originator or HCL or its
> >>> affiliates. Any views or opinions presented in
> >>> this email are solely those of the author and may not necessarily
> reflect
> >>> the opinions of HCL or its affiliates.
> >>> Any form of reproduction, dissemination, copying, disclosure,
> modification,
> >>> distribution and / or publication of
> >>> this message without the prior written consent of the author of this
> e-mail
> >>> is strictly prohibited. If you have
> >>> received this email in error please delete it and notify the sender
> >>> immediately. Before opening any mail and
> >>> attachments please check them for viruses and defect.
> >>>
> >>>
> >>>
> -----------------------------------------------------------------------------------------------------------------------
> >>>
> >
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

samhamilton
On product A - with a description and no long description:
====> <p><span style="font-size: small;">
<p><span style="font-size: medium;">One Size.</span></p>
<p><span style="font-size: medium;">Includes: Headpiece; Body; Legs</span></p>
<p><span style="font-size: medium;">Best Fit :Height&nbsp;6ft ,44in chest, Inside leg 33in</span></p>
</span></p>
====>

On product B - with a long_description and no description
====>

====> <p>* Designer wallet from Von Zipper<br />* 100% PVC<br />* Brand new season<br /><br /><br /></p>

There is content in there!

Thanks
Sam


On 20 Jun 2011, at 18:18, prasanth r wrote:

> Sam,
> Print and see,
> ====> ${productContentWrapper.get("DESCRIPTION")}
>
> ====> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> post the output too.
> thanks
> prasath. r
>
> On Mon, Jun 20, 2011 at 3:42 PM, Sam Hamilton <[hidden email]> wrote:
>
>> Hi,
>>
>> All the examples including yours seem to work like this
>> if the code snippet checked for the description first then
>> If product A has a description then it shows a description
>> If product B has a long_description then it shows nothing.
>>
>> If you then swap the code so that it checks for long_description first then
>> If product A has a description then it shows nothing
>> If product B has a long_description then it shows the long_description.
>>
>> ${productContentWrapper} just shows
>> org.ofbiz.product.product.ProductContentWrapper@6ec0ac92
>>
>> Thanks
>> Sam
>>
>>
>> On 20 Jun 2011, at 18:03, Hardik Handa wrote:
>>
>>> Sam,
>>>
>>> Wat does it print when u use the code lines I provided ???
>>> It would be of help to me to figure out the actual problem
>>>
>>> -----Original Message-----
>>> From: Sam Hamilton [mailto:[hidden email]]
>>> Sent: Monday, June 20, 2011 3:31 PM
>>> To: [hidden email]
>>> Subject: Re: Help with a FTL if
>>>
>>> Hi Hardik and Jacques - tried both that and also does not work.
>>>
>>> So far the only solution would be to hope that one product does not have
>> both a description and a long_description and use:
>>> ${productContentWrapper.get("DESCRIPTION")}
>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>
>>> Very fustrating!
>>>
>>> Sam
>>>
>>>
>>> On 20 Jun 2011, at 17:54, prasanth r wrote:
>>>
>>>> hardick,
>>>>
>>>> exists will only check for existance of the variable. is it?
>>>>
>>>> thanks
>>>> prasath. r
>>>>
>>>> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]>
>> wrote:
>>>>
>>>>> <#if productContentWrapper.get("DESCRIPTION")?exists>
>>>>>
>>>>> ${productContentWrapper.get("DESCRIPTION")}
>>>>>
>>>>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
>>>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>
>>>>> </#if>
>>>>>
>>>>>
>>>>> This should do the trick
>>>>>
>>>>> Regards,
>>>>> Hardik Handa
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Sam Hamilton [mailto:[hidden email]]
>>>>> Sent: Monday, June 20, 2011 3:10 PM
>>>>> To: [hidden email]
>>>>> Subject: Re: Help with a FTL if
>>>>>
>>>>> Thanks for the help but that didn't work either!?
>>>>>
>>>>> If the long_description is called first then where there is a long
>>>>> description on a product it shows the long description but does not
>> show the
>>>>> description on products where there is no long description and only a
>>>>> description and most annoyingly if the description is called first then
>> it
>>>>> shows description but not the long description on products that don't
>> have a
>>>>> description but do have a long description.
>>>>>
>>>>>
>>>>> Sam
>>>>>
>>>>> On 20 Jun 2011, at 17:16, prasanth r wrote:
>>>>>
>>>>>> sam,
>>>>>>
>>>>>> I hope we cannot use has_content with not existing variables. So, I
>>>>> suggest
>>>>>> to use 'exists' before has_content
>>>>>>
>>>>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>>>>>>                ${productContentWrapper.get("DESCRIPTION")}
>>>>>> <#else>
>>>>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>
>>>>>>> </#if>
>>>>>>
>>>>>>
>>>>>> best wishes
>>>>>> prasath.r
>>>>>> 9442369696
>>>>>>
>>>>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi Prasath
>>>>>>>
>>>>>>> Thanks for pointing that out so the revised code should look
>> something
>>>>> like
>>>>>>> this so that if there is no content in description is uses
>>>>> long_description?
>>>>>>>
>>>>>>>    <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>>>>>>        ${productContentWrapper.get("DESCRIPTION")}
>>>>>>>        <#else>
>>>>>>>        ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>>     </#if>
>>>>>>>
>>>>>>> Sam
>>>>>>>
>>>>>>>
>>>>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>>>>>>
>>>>>>>> Hi sam,
>>>>>>>>
>>>>>>>> 'exists' will check for existence of the variable.
>>>>>>>> 'if_exists' will check for 'null' value.
>>>>>>>> if you want to check the value then use has_content.
>>>>>>>>
>>>>>>>> I hope it will help you.
>>>>>>>>
>>>>>>>> prasath
>>>>>>>> 9442369696
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Can someone help me with this if statement - i can only get it to
>>>>> return
>>>>>>> a
>>>>>>>>> value for long_description if one exists where as I want it to
>> return
>>>>> a
>>>>>>>>> description if no long_description is found?
>>>>>>>>>
>>>>>>>>>       <#assign prodDesc =
>>>>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>>>>>>       <#if prodDesc?exists>
>>>>>>>>>           ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>>>>       <#else>
>>>>>>>>>           ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>>>>>>       </#if>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> Sam
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>> ::DISCLAIMER::
>>>>>
>>>>>
>> -----------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>> The contents of this e-mail and any attachment(s) are confidential and
>>>>> intended for the named recipient(s) only.
>>>>> It shall not attach any liability on the originator or HCL or its
>>>>> affiliates. Any views or opinions presented in
>>>>> this email are solely those of the author and may not necessarily
>> reflect
>>>>> the opinions of HCL or its affiliates.
>>>>> Any form of reproduction, dissemination, copying, disclosure,
>> modification,
>>>>> distribution and / or publication of
>>>>> this message without the prior written consent of the author of this
>> e-mail
>>>>> is strictly prohibited. If you have
>>>>> received this email in error please delete it and notify the sender
>>>>> immediately. Before opening any mail and
>>>>> attachments please check them for viruses and defect.
>>>>>
>>>>>
>>>>>
>> -----------------------------------------------------------------------------------------------------------------------
>>>>>
>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

Jacques Le Roux
Administrator
In reply to this post by samhamilton
Are you sure to have an instance of productContentWrapper? Else you should have something like below before calling what I suggested

<#assign productContentWrapper = productData.productContentWrapper/>

see compareproducts.ftl[109] for instance

To prasath: ! is the same as ?default(). There are examples in OFBiz

Jacques

Sam Hamilton wrote:

> Hi Hardik and Jacques - tried both that and also does not work.
>
> So far the only solution would be to hope that one product does not have both a description and a long_description and use:
> ${productContentWrapper.get("DESCRIPTION")}
> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> Very fustrating!
>
> Sam
>
>
> On 20 Jun 2011, at 17:54, prasanth r wrote:
>
>> hardick,
>>
>> exists will only check for existance of the variable. is it?
>>
>> thanks
>> prasath. r
>>
>> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]> wrote:
>>
>>> <#if productContentWrapper.get("DESCRIPTION")?exists>
>>>
>>> ${productContentWrapper.get("DESCRIPTION")}
>>>
>>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>
>>> </#if>
>>>
>>>
>>> This should do the trick
>>>
>>> Regards,
>>> Hardik Handa
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Sam Hamilton [mailto:[hidden email]]
>>> Sent: Monday, June 20, 2011 3:10 PM
>>> To: [hidden email]
>>> Subject: Re: Help with a FTL if
>>>
>>> Thanks for the help but that didn't work either!?
>>>
>>> If the long_description is called first then where there is a long
>>> description on a product it shows the long description but does not show the
>>> description on products where there is no long description and only a
>>> description and most annoyingly if the description is called first then it
>>> shows description but not the long description on products that don't have a
>>> description but do have a long description.
>>>
>>>
>>> Sam
>>>
>>> On 20 Jun 2011, at 17:16, prasanth r wrote:
>>>
>>>> sam,
>>>>
>>>> I hope we cannot use has_content with not existing variables. So, I
>>> suggest
>>>> to use 'exists' before has_content
>>>>
>>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>>>>                  ${productContentWrapper.get("DESCRIPTION")}
>>>> <#else>
>>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>
>>>>> </#if>
>>>>
>>>>
>>>> best wishes
>>>> prasath.r
>>>> 9442369696
>>>>
>>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>>>>
>>>>> Hi Prasath
>>>>>
>>>>> Thanks for pointing that out so the revised code should look something
>>> like
>>>>> this so that if there is no content in description is uses
>>> long_description?
>>>>>
>>>>>      <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>>>>          ${productContentWrapper.get("DESCRIPTION")}
>>>>>          <#else>
>>>>>          ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>       </#if>
>>>>>
>>>>> Sam
>>>>>
>>>>>
>>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>>>>
>>>>>> Hi sam,
>>>>>>
>>>>>> 'exists' will check for existence of the variable.
>>>>>> 'if_exists' will check for 'null' value.
>>>>>> if you want to check the value then use has_content.
>>>>>>
>>>>>> I hope it will help you.
>>>>>>
>>>>>> prasath
>>>>>> 9442369696
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Can someone help me with this if statement - i can only get it to return a
>>>>>>> value for long_description if one exists where as I want it to return
>>> a
>>>>>>> description if no long_description is found?
>>>>>>>
>>>>>>>         <#assign prodDesc =
>>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>>>>         <#if prodDesc?exists>
>>>>>>>             ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>>         <#else>
>>>>>>>             ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>>>>         </#if>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> Sam
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>>>>> DISCLAIMER::
>>>
>>> -----------------------------------------------------------------------------------------------------------------------
>>>
>>> The contents of this e-mail and any attachment(s) are confidential and
>>> intended for the named recipient(s) only.
>>> It shall not attach any liability on the originator or HCL or its
>>> affiliates. Any views or opinions presented in
>>> this email are solely those of the author and may not necessarily reflect
>>> the opinions of HCL or its affiliates.
>>> Any form of reproduction, dissemination, copying, disclosure, modification,
>>> distribution and / or publication of
>>> this message without the prior written consent of the author of this e-mail
>>> is strictly prohibited. If you have
>>> received this email in error please delete it and notify the sender
>>> immediately. Before opening any mail and
>>> attachments please check them for viruses and defect.
>>>
>>>
>>> -----------------------------------------------------------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Help with a FTL if

samhamilton
In reply to this post by prasath
On product A - with a description and no long description:
====> <p>
<snip real description>
====>

On product B - with a long_description and no description
====>

====> <p> <snip real description>

There is content in there!

Thanks
Sam



On 20 Jun 2011, at 18:18, prasanth r wrote:

> Sam,
> Print and see,
> ====> ${productContentWrapper.get("DESCRIPTION")}
>
> ====> ${productContentWrapper.get("LONG_DESCRIPTION")}
>
> post the output too.
> thanks
> prasath. r
>
> On Mon, Jun 20, 2011 at 3:42 PM, Sam Hamilton <[hidden email]> wrote:
>
>> Hi,
>>
>> All the examples including yours seem to work like this
>> if the code snippet checked for the description first then
>> If product A has a description then it shows a description
>> If product B has a long_description then it shows nothing.
>>
>> If you then swap the code so that it checks for long_description first then
>> If product A has a description then it shows nothing
>> If product B has a long_description then it shows the long_description.
>>
>> ${productContentWrapper} just shows
>> org.ofbiz.product.product.ProductContentWrapper@6ec0ac92
>>
>> Thanks
>> Sam
>>
>>
>> On 20 Jun 2011, at 18:03, Hardik Handa wrote:
>>
>>> Sam,
>>>
>>> Wat does it print when u use the code lines I provided ???
>>> It would be of help to me to figure out the actual problem
>>>
>>> -----Original Message-----
>>> From: Sam Hamilton [mailto:[hidden email]]
>>> Sent: Monday, June 20, 2011 3:31 PM
>>> To: [hidden email]
>>> Subject: Re: Help with a FTL if
>>>
>>> Hi Hardik and Jacques - tried both that and also does not work.
>>>
>>> So far the only solution would be to hope that one product does not have
>> both a description and a long_description and use:
>>> ${productContentWrapper.get("DESCRIPTION")}
>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>
>>> Very fustrating!
>>>
>>> Sam
>>>
>>>
>>> On 20 Jun 2011, at 17:54, prasanth r wrote:
>>>
>>>> hardick,
>>>>
>>>> exists will only check for existance of the variable. is it?
>>>>
>>>> thanks
>>>> prasath. r
>>>>
>>>> On Mon, Jun 20, 2011 at 3:21 PM, Hardik Handa <[hidden email]>
>> wrote:
>>>>
>>>>> <#if productContentWrapper.get("DESCRIPTION")?exists>
>>>>>
>>>>> ${productContentWrapper.get("DESCRIPTION")}
>>>>>
>>>>> <#elseif productContentWrapper.get("LONG_DESCRIPTION")?exists >
>>>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>
>>>>> </#if>
>>>>>
>>>>>
>>>>> This should do the trick
>>>>>
>>>>> Regards,
>>>>> Hardik Handa
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Sam Hamilton [mailto:[hidden email]]
>>>>> Sent: Monday, June 20, 2011 3:10 PM
>>>>> To: [hidden email]
>>>>> Subject: Re: Help with a FTL if
>>>>>
>>>>> Thanks for the help but that didn't work either!?
>>>>>
>>>>> If the long_description is called first then where there is a long
>>>>> description on a product it shows the long description but does not
>> show the
>>>>> description on products where there is no long description and only a
>>>>> description and most annoyingly if the description is called first then
>> it
>>>>> shows description but not the long description on products that don't
>> have a
>>>>> description but do have a long description.
>>>>>
>>>>>
>>>>> Sam
>>>>>
>>>>> On 20 Jun 2011, at 17:16, prasanth r wrote:
>>>>>
>>>>>> sam,
>>>>>>
>>>>>> I hope we cannot use has_content with not existing variables. So, I
>>>>> suggest
>>>>>> to use 'exists' before has_content
>>>>>>
>>>>>> #if productContentWrapper.get("DESCRIPTION")?exists?has_content>
>>>>>>                ${productContentWrapper.get("DESCRIPTION")}
>>>>>> <#else>
>>>>>> ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>
>>>>>>> </#if>
>>>>>>
>>>>>>
>>>>>> best wishes
>>>>>> prasath.r
>>>>>> 9442369696
>>>>>>
>>>>>> On Mon, Jun 20, 2011 at 2:42 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>>
>>>>>>> Hi Prasath
>>>>>>>
>>>>>>> Thanks for pointing that out so the revised code should look
>> something
>>>>> like
>>>>>>> this so that if there is no content in description is uses
>>>>> long_description?
>>>>>>>
>>>>>>>    <#if productContentWrapper.get("DESCRIPTION")?has_content>
>>>>>>>        ${productContentWrapper.get("DESCRIPTION")}
>>>>>>>        <#else>
>>>>>>>        ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>>     </#if>
>>>>>>>
>>>>>>> Sam
>>>>>>>
>>>>>>>
>>>>>>> On 20 Jun 2011, at 16:56, prasanth r wrote:
>>>>>>>
>>>>>>>> Hi sam,
>>>>>>>>
>>>>>>>> 'exists' will check for existence of the variable.
>>>>>>>> 'if_exists' will check for 'null' value.
>>>>>>>> if you want to check the value then use has_content.
>>>>>>>>
>>>>>>>> I hope it will help you.
>>>>>>>>
>>>>>>>> prasath
>>>>>>>> 9442369696
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Jun 20, 2011 at 2:20 PM, Sam Hamilton <[hidden email]> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Can someone help me with this if statement - i can only get it to
>>>>> return
>>>>>>> a
>>>>>>>>> value for long_description if one exists where as I want it to
>> return
>>>>> a
>>>>>>>>> description if no long_description is found?
>>>>>>>>>
>>>>>>>>>       <#assign prodDesc =
>>>>>>>>> productContentWrapper.get("LONG_DESCRIPTION")?if_exists>
>>>>>>>>>       <#if prodDesc?exists>
>>>>>>>>>           ${productContentWrapper.get("LONG_DESCRIPTION")}
>>>>>>>>>       <#else>
>>>>>>>>>           ${productContentWrapper.get("DESCRIPTION")?if_exists}
>>>>>>>>>       </#if>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> Sam
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>> ::DISCLAIMER::
>>>>>
>>>>>
>> -----------------------------------------------------------------------------------------------------------------------
>>>>>
>>>>> The contents of this e-mail and any attachment(s) are confidential and
>>>>> intended for the named recipient(s) only.
>>>>> It shall not attach any liability on the originator or HCL or its
>>>>> affiliates. Any views or opinions presented in
>>>>> this email are solely those of the author and may not necessarily
>> reflect
>>>>> the opinions of HCL or its affiliates.
>>>>> Any form of reproduction, dissemination, copying, disclosure,
>> modification,
>>>>> distribution and / or publication of
>>>>> this message without the prior written consent of the author of this
>> e-mail
>>>>> is strictly prohibited. If you have
>>>>> received this email in error please delete it and notify the sender
>>>>> immediately. Before opening any mail and
>>>>> attachments please check them for viruses and defect.
>>>>>
>>>>>
>>>>>
>> -----------------------------------------------------------------------------------------------------------------------
>>>>>
>>>
>>
>>

12