Jump to content

!empty() is not working in feature value


PrabuSS

Recommended Posts

Hi

 

I would like to display the features value in product detail page is not empty. So I've tried like this

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}
        
       {if !empty($feature.value)}

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}
 

But my Output : +

 

It seems !empty() function is not working in feature value. Please help any one.

 

Edited by PrabuSS (see edit history)
Link to comment
Share on other sites

Hi

 

I would like to display the features value in product detail page is not empty. So I've tried like this

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}
        
       {if !empty($feature.value)}

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}
 

But my Output : +

 

It seems !empty() function is not working in feature value. Please help any one.

 

Try

!= ''
Link to comment
Share on other sites

 

Try

!= ''

Thanks for your reply.. As per your suggestion I've tried like this. But this is also not working..Still cant find correct syntax to done this.

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}
        
       {if $feature.value != ''} 

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}
Edited by PrabuSS (see edit history)
Link to comment
Share on other sites

 

Thanks for your reply.. As per your suggestion I've tried like this. But this is also not working..Still cant find correct syntax to done this.

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}
        
       {if $feature.value != ''} 

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}

 

Try

{$feature|@var_dump}

to see its content, maybe is not empty.

Link to comment
Share on other sites

Hi

 

How can i use this {$feature|@var_dump} in my code..And I'm able to see the feature value at BO it self. 

 

please make it clear..

 

Put it before your if condition:

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}

       {$feature|@var_dump}   
       {if $feature.value != ''} 

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}
  • Like 1
Link to comment
Share on other sites

 

Put it before your if condition:

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}

       {$feature|@var_dump}   
       {if $feature.value != ''} 

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}

Hi

 

Thanks for your reply. I've used {$feature|@var_dump} like as above. I'm getting following output

array(3) { ["name"]=> string(6) "P2_col" ["value"]=> string(1) " " ["id_feature"]=> string(2) "16" }
Edited by PrabuSS (see edit history)
Link to comment
Share on other sites

 

Put it before your if condition:

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}

       {$feature|@var_dump}   
       {if $feature.value != ''} 

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}

Yessssss. Finally I've used following code to achieve this. Credit goes to you only my great friend  :wub: . PS forum is in still active because of person like you  :)

{foreach from=$features item=feature}

    {if $feature.id_feature == 16}

       {if $feature.value != " "} 

           <span> + </span>{$feature.value|escape:'html':'UTF-8'}
       
       {/if}
     
     {/if}

{/foreach}

So In PS 1.6 this is the condition to restrict empty feature value in product detail page {if $feature.value != " "}. Hope its helpful for some one.

Edited by PrabuSS (see edit history)
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...