kijy Posted July 7, 2015 Share Posted July 7, 2015 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 More sharing options...
vekia Posted July 7, 2015 Share Posted July 7, 2015 hello you mean that you added some fields to: - database - object class and now want to display them on product listings? Link to comment Share on other sites More sharing options...
kijy Posted July 7, 2015 Author Share Posted July 7, 2015 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 More sharing options...
vekia Posted July 7, 2015 Share Posted July 7, 2015 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 More sharing options...
kijy Posted July 8, 2015 Author Share Posted July 8, 2015 Ok, and where can i check/add my new features id? Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2015 Share Posted July 8, 2015 id of the feature you can find in your back office "catalog" > "product features" Link to comment Share on other sites More sharing options...
kijy Posted July 8, 2015 Author Share Posted July 8, 2015 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 More sharing options...
vekia Posted July 8, 2015 Share Posted July 8, 2015 it will work only in product.tpl file have you cleared cache of the shop? does the product contains the feature you used (id) ? Link to comment Share on other sites More sharing options...
kijy Posted July 8, 2015 Author Share Posted July 8, 2015 (edited) 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 July 8, 2015 by kijy (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2015 Share Posted July 8, 2015 omg i missed fact that you want to display features in featured products not on product page Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2015 Share Posted July 8, 2015 {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 More sharing options...
kijy Posted July 8, 2015 Author Share Posted July 8, 2015 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 More sharing options...
vekia Posted July 8, 2015 Share Posted July 8, 2015 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 Link to comment Share on other sites More sharing options...
kijy Posted July 8, 2015 Author Share Posted July 8, 2015 THIS IS AWESOME! You're living live god tuto maker! Thank a lot! You rocks Milos! Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2015 Share Posted July 8, 2015 sorry for many mistakes in the code i definitely need more coffee Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now