Jump to content

Is it possible to add custom field to a product and display it in FeaturedProducts?


kijy

Recommended Posts

Hi everyone!, i'd like to make a FeaturedProduct module that display a lot of information, not just the title and description. Does somebody know how to display any custom field to the product's description? I already know how to make the predefine fields to apprear, but i'm blocking on this one.

 

 

thx already!

Link to comment
Share on other sites

I meant that i put some new custom field in the feature tab, and i was looking for a way to call it in a .tpl without having to register the new fields in product.php.

Is it even possible?

Link to comment
Share on other sites

it is but only with foreach loop on features variable, where you will have to check ID of feature to display only selected feature.

 

{foreach from=$features item=feature}
{if $deature.id_feature==5}
this is my feature with id 5
{$feature.name|escape:'html':'UTF-8'}
{$feature.value|escape:'html':'UTF-8'}
{/if}
{/foreach}
Link to comment
Share on other sites

Thx so much!

And last but not least, the part of code that you gave me earlier, do i put it right into the .tpl where i want it to appaer? cause that I've done, and nothing showd up..

Link to comment
Share on other sites

Oh. that explain why it's not working that well.. (cache cleard and my product does has the feature)

I put it in product-list.tpl. So i guess i have to put it down in product.tpl then call it in product-list?

 

ps: I put it there cause that's where i think that featuredproducts module pick up its data; that where i could make it shows the full description of the product, but correctme if i'm wrong!

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


{if isset($product.features)}

<div class="ProductFeatures">

{foreach from=$product.features item=feature}

{if $feature.id_feature==3}

{$feature.name}: <span>{$feature.value}</span>

{/if}

{/foreach}

</div>

{/if}

 

Link to comment
Share on other sites

Arf, I put these line in my Product-list.tpl and nothing happen yet.. (All my caches are still turned off)

You talk about controller earlier, What should i do with it? (i guess U talk about ProductController.php) 

Link to comment
Share on other sites

no it was my mistake, it is not necessary to alter controllers

 

here is the proper code

{if isset($product.features)}
    <div class="ProductFeatures">
            {foreach from=$product.features item=feature}
               {if $feature.id_feature==5}
                    {$feature.name}: <span>{$feature.value}</span>
               {/if}
            {/foreach}
    </div>
{/if} 

effect

ALv1uDC.png

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...