nakul Posted October 4, 2013 Share Posted October 4, 2013 (edited) Hi all, As usual thanks to prestashop for such a great community foums. I want help in Product Comparision functionality.Go to http://www.tabsort.org/39-narrow-your-search Select amost 4 products for comparision.At the comparision u will c YES/NO against their feature. I want to change from yes/no to images that i have attached.How to put those images on the table. Its for (YES/NO) only.Hopefully u got what i said. Thanks. Edited October 5, 2013 by nakul (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted October 5, 2013 Share Posted October 5, 2013 Hi nakul, probably in file /themes/<your theme folder>/products-comparison.tpl: (backup first!) there is a piece of code: (around line 110 in PS 1.5.5.0) {if $ordered_features} {foreach from=$ordered_features item=feature} <tr> {cycle values='comparison_feature_odd,comparison_feature_even' assign='classname'} <td class="{$classname}" > <strong>{$feature.name|escape:'htmlall':'UTF-8'}</strong> </td> {foreach from=$products item=product name=for_products} {assign var='product_id' value=$product->id} {assign var='feature_id' value=$feature.id_feature} {if isset($product_features[$product_id])} {assign var='tab' value=$product_features[$product_id]} <td width="{$width}%" class="{$classname} comparison_infos">{if (isset($tab[$feature_id]))}{$tab[$feature_id]|escape:'htmlall':'UTF-8'}{/if}</td> {else} <td width="{$width}%" class="{$classname} comparison_infos"></td> {/if} {/foreach} </tr> {/foreach} Expand this with a check : {if $tab[$feature_id] == 'Yes'}, add something like <img class = "comparison_yes" src="path/to/checked_picture.jpg"> else if $tab[$feature_id] == 'No' add <img "comparison_no" src="path/to/crossed_picture.jpg"> else show original code: {$tab[$feature_id]|escape:'htmlall':'UTF-8'} Hope this helps, pascal 1 Link to comment Share on other sites More sharing options...
nakul Posted October 5, 2013 Author Share Posted October 5, 2013 Hi Pascal, Thanks for reply. I am getting error while putting my code. (actually i am a java guy so dont know much about PHP ) Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/content/68/10807668/html/mydomains/TABSORT.ORG/themes/elegant/products-comparison.tpl" on line 186 "{if($tab[$feature_id]=='Yes')}" unknown function "if"' in /home/content/68/10807668/html/mydomains/TABSORT.ORG/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:665 Stack trace: #0 /home/content/68/10807668/html/mydomains/TABSORT.ORG/tools/smarty/sysplugins/smarty_internal_templateparser.php(2900): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown functio...') #1 /home/content/68/10807668/html/mydomains/TABSORT.ORG/tools/smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r153() #2 /home/content/68/10807668/html/mydomains/TABSORT.ORG/tools/smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(153) #3 /home/content/68/10807668/html/mydomains/TABSORT.ORG/tools/smarty/sy in /home/content/68/10807668/html/mydomains/TABSORT.ORG/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 665 my code is below <td width="{$width}%" class="{$classname} comparison_infos">{if (isset($tab[$feature_id]))} { {if($tab[$feature_id]=='Yes')} {<img src="http://www.tabsort.org/img/yes_icon.png">} {/if} {if($tab[$feature_id]=='No')} {<img src="http://www.tabsort.org/img/no_icon.png">} {/if} {elseif} {$tab[$feature_id]|escape:'htmlall':'UTF-8'} } {/if} </td> Whats the problem. Help me out. NakuL Link to comment Share on other sites More sharing options...
nakul Posted October 5, 2013 Author Share Posted October 5, 2013 Many many thanks PASCAL for such a great help. :D :D :D :D :D :D :D :D :D :D Its now working Great. here the final working code.I will be glad if any one uses. {if $ordered_features} {foreach from=$ordered_features item=feature} <tr> {cycle values='comparison_feature_odd,comparison_feature_even' assign='classname'} <td class="{$classname}" > <font color="#B23F33"><strong>{$feature.name|escape:'htmlall':'UTF-8'}</strong></font> </td> {foreach from=$products item=product name=for_products} {assign var='product_id' value=$product->id} {assign var='feature_id' value=$feature.id_feature} {if isset($product_features[$product_id])} {assign var='tab' value=$product_features[$product_id]} <td width="{$width}%" class="{$classname} comparison_infos">{if (isset($tab[$feature_id]))}{$tab[$feature_id]|escape:'htmlall':'UTF-8'}{/if} {if (($tab[$feature_id])=='Yes')}<img src="your_image_location"/>{/if}{if (($tab[$feature_id])=='No')}<img src="yourImage_location"/>{/if}</td> {else} <td width="{$width}%" class="{$classname} comparison_infos"></td> {/if} {/foreach} </tr> {/foreach} Link to comment Share on other sites More sharing options...
PascalVG Posted October 5, 2013 Share Posted October 5, 2013 Perfect! If I see correctly, you keep the Yes and No, but just added the checked/Crossed image after it, right? Please mark your Topic as solved when happy with the solution (See my footer text on how to) Happy selling, pascal Link to comment Share on other sites More sharing options...
nakul Posted October 5, 2013 Author Share Posted October 5, 2013 Perfect! If I see correctly, you keep the Yes and No, but just added the checked/Crossed image after it, right? Please mark your Topic as solved when happy with the solution (See my footer text on how to) Happy selling, pascal How it looks??? (just asking ur openion) Should I remove YES/NO and put only images??? Link to comment Share on other sites More sharing options...
PascalVG Posted October 5, 2013 Share Posted October 5, 2013 I think I would take the text out, (but that's only my opinion) :-) pascal 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