schel4ok Posted March 10, 2011 Share Posted March 10, 2011 Is there any way to show product features on category page?For instance, air conditioner has 10 features, but on product pages it is needed to show only 2-3 main features (cool power, heat power and air flow).example is here http://www.airfresh.ru/nastennye-split-sistemy.htm Link to comment Share on other sites More sharing options...
Broceliande Posted March 13, 2011 Share Posted March 13, 2011 Hi, did you find it ?Here is how i did it in product-list.tpl :A little php code inside smarty getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> {if $product.new == 1}{l s='new'}{/if}{$product.name|escape:'htmlall':'UTF-8'|truncate:80:'...'} Signé {$product.manufacturer_name} {$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'} <!-- product's features --> {php} global $cookie; $product=$this->get_template_vars('product'); // nb $this IS smarty $myprod = new Product($product['id_product']); $features = $myprod->getFrontFeatures(intval($cookie->id_lang)); $this->assign('features',$features); {/php} {if $features} {foreach from=$features item=feature} THERE WAHTEVER YOU NEED TO DISPLAY ABOUT FEATURES EX: {$feature.value|escape:'htmlall':'UTF-8'} {/foreach} {/if} Link to comment Share on other sites More sharing options...
eGzyl.pl Posted March 14, 2011 Share Posted March 14, 2011 u must know css a litle and then u can make its yourself Link to comment Share on other sites More sharing options...
schel4ok Posted March 14, 2011 Author Share Posted March 14, 2011 I'm not good in smarty, but your code is not working. <!-- product's features --> {php} global $cookie; $product=$this->get_template_vars('product'); // nb $this IS smarty $myprod = new Product($product['id_product']); $features = $myprod->getFrontFeatures(intval($cookie->id_lang)); $this->assign('features',$features); {/php} {if $features} {foreach from=$features item=feature} THERE WAHTEVER YOU NEED TO DISPLAY ABOUT FEATURES EX: {$feature.value|escape:'htmlall':'UTF-8'} {/foreach} {/if} I copied it inside and it brakes my category page. You can see difference on 2 attached screenshots:screenshot.13.jpg - normal category viewscreenshot.11.jpg - after inserting your code Link to comment Share on other sites More sharing options...
Broceliande Posted March 14, 2011 Share Posted March 14, 2011 did you just copy+paste my code as it ?This is only the method to use.This works for me but the code i gave is only an example ,you may have to adapt it depending on your needs.Post me your product-list.tpl . I'll modify it for you with a working example. Link to comment Share on other sites More sharing options...
schel4ok Posted March 14, 2011 Author Share Posted March 14, 2011 I have standard product-list from default template.I attached it. product-list.zip Link to comment Share on other sites More sharing options...
Broceliande Posted March 14, 2011 Share Posted March 14, 2011 I now know why it didn't work . My code is for 1.3 , you use 1.4I'll try to do the same on 1.4 then. Link to comment Share on other sites More sharing options...
need4speed Posted May 6, 2011 Share Posted May 6, 2011 Shel...Could you add the features to my product-list file? Im running 1.3.6.0 > {if isset($products)} <!-- Products list --> </pre> <ul> {foreach from=$products item=product name=products} {if $product.on_sale} {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product.reduction_from))} {/if} getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" width="{$homeSize.width}" height="{$homeSize.height}" />{if $product.new == 1}{l s='new'}{/if} {$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'} {$product.description_short|truncate:150:'...'|strip_tags:'UTF-8'} {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc} {/if} {l s='tax incl.'} {convertPrice price=$product.price_tax_exc} {l s='tax excl.'} {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {else} {l s='Add to cart'} {/if} {/foreach} <!-- /Products list --> {/if} Link to comment Share on other sites More sharing options...
shacker Posted June 1, 2011 Share Posted June 1, 2011 in presta 1.4 you cant use {php} tag. Link to comment Share on other sites More sharing options...
Artizzz Posted June 2, 2011 Share Posted June 2, 2011 Maybe someone can tell or give a clue how to add tags in product-list page? (In prestashop version 1.4.x) Link to comment Share on other sites More sharing options...
123maverick456 Posted June 7, 2011 Share Posted June 7, 2011 Hi... for prestashop 1.4, in product-list.tpl you cannot use: > {if $features} <!-- product's features --> </pre> <ul> {foreach from=$features item=feature} {$feature.name|escape:'htmlall':'UTF-8'} {$feature.value|escape:'htmlall':'UTF-8} {/foreach} </ul> <br>{/if} replace with: > </pre> <ul> {foreach from=$product.features item=feature name=features} {$feature.name|escape:'htmlall':'UTF-8'} {$feature.value|escape:'htmlall':'UTF-8'} {/foreach} </ul> happy coding 1 Link to comment Share on other sites More sharing options...
shacker Posted June 8, 2011 Share Posted June 8, 2011 this works. thanks Link to comment Share on other sites More sharing options...
123maverick456 Posted June 8, 2011 Share Posted June 8, 2011 this works. thanks you're welcome... btw if you know something about integrated paypal payment (third party modules or default available modules) please help me at: http://www.prestashop.com/forums/viewthread/113729/or if you know something about gift certificate module, please help at: http://www.prestashop.com/forums/viewthread/112393/Thanks a lot Link to comment Share on other sites More sharing options...
schel4ok Posted June 19, 2011 Author Share Posted June 19, 2011 Great!But produts can have a lot of features, let say 20.In this case it is needed to show only few of them.Is it possible to choose which features we will show on product list page?like this {foreach from=$product.features item=feature name=features where $feature.name = "power" & $feature.name = "air flow" & $feature.name = "room area"} Link to comment Share on other sites More sharing options...
schel4ok Posted June 19, 2011 Author Share Posted June 19, 2011 Yes I did it! ><!-- product's features --> {if $product.features} </pre> <table>{$feature.name|escape:'htmlall':'UTF-8'}{$feature.value|escape:'htmlall':'UTF-8'}</table> <br>{/if} <br><!-- product's features Link to comment Share on other sites More sharing options...
ltempest Posted March 15, 2012 Share Posted March 15, 2012 How do you find out the id of your required feature? which table in the database do you refer to? I really need to display one of my features on the product-list.tpl page but the code above gives me the incorrect feature. Please help going around in circles trying to solve it! Thanks Lee Link to comment Share on other sites More sharing options...
amoth Posted June 11, 2012 Share Posted June 11, 2012 How do you find out the id of your required feature? which table in the database do you refer to? I really need to display one of my features on the product-list.tpl page but the code above gives me the incorrect feature. Please help going around in circles trying to solve it! Thanks Lee Hi, ID of feature is in ps_feature and the name that belongs to ID is in ps_feature_lang. Code dosent work because there is nothing inside <if> so the condition cant work this is working code: <!-- product's features --> {if $product.features} {foreach from=$product.features item=feature name=features} {if $feature.id_feature == 8 OR $feature.id_feature == 9 } <span class="feture">{$feature.name|escape:'htmlall':'UTF-8'}: {$feature.value|escape:'htmlall':'UTF-8'}</span> {/if} {/foreach} {/if} <!-- product's features --> 1 Link to comment Share on other sites More sharing options...
jincmd Posted December 11, 2012 Share Posted December 11, 2012 Thank you guys. I am tempted to try this, although I'm not really sure what it does... Will it work on 1.5? Link to comment Share on other sites More sharing options...
romank Posted January 16, 2013 Share Posted January 16, 2013 Yes, it work on 1.5.3.1. Link to comment Share on other sites More sharing options...
PrestaShark Posted June 12, 2014 Share Posted June 12, 2014 Tested on 1.5.6.2 It works Many thanks! Link to comment Share on other sites More sharing options...
dfmrego Posted September 13, 2014 Share Posted September 13, 2014 Hi, ID of feature is in ps_feature and the name that belongs to ID is in ps_feature_lang. Code dosent work because there is nothing inside <if> so the condition cant work this is working code: <!-- product's features --> {if $product.features} {foreach from=$product.features item=feature name=features} {if $feature.id_feature == 8 OR $feature.id_feature == 9 } <span class="feture">{$feature.name|escape:'htmlall':'UTF-8'}: {$feature.value|escape:'htmlall':'UTF-8'}</span> {/if} {/foreach} {/if} <!-- product's features --> Thanks for this info... I also was trying to find the way to get the features by ID without luck until found your post! Link to comment Share on other sites More sharing options...
StephenHenry Posted November 28, 2015 Share Posted November 28, 2015 Hi... for prestashop 1.4, in product-list.tpl you cannot use: {if $features} <!-- product's features --> <ul> {foreach from=$features item=feature} <li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8}</li> {/foreach} </ul>{/if} replace with: <ul>{foreach from=$product.features item=feature name=features} <li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8'}</li> {/foreach}</ul> happy coding I used this in 1.6 in product-list.tpl and it worked perfectly. Thank you so much. I placed it below {$product.name|truncate:45:'...'|escape:'html':'UTF-8'} </a> Steve Link to comment Share on other sites More sharing options...
pegasus6464 Posted April 10, 2017 Share Posted April 10, 2017 can i show field "description" on product-list.tpl?THANKS! 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