ajspiano Posted November 25, 2013 Share Posted November 25, 2013 So this is a problem I've been mulling over for a while, I even considered buying a module to do this which required professional installation due to database modifications. But! today I solved this using 'features' and a few code alterations on product.tpl (albeit messy ones i suspect) So now I'm sharing because I'd have loved this have to been on the forum last week (my apologies if I simply failed to find it). ..................... Alright, if you add a feature you can set up a customised value for every product, its like adding your own custom product field to the database. Cool. But by default it displays in a 'datasheet' tab alongside your other product tabs like 'more info' and accessories. This didn't help me.. I want it to display up near the prices, and not with bullets. Down near the bottom of product.tpl you'll find this, ~line 515 <div id="more_info_block" class="clear"> <ul id="more_info_tabs" class="idTabs idTabsShort clearfix"> {if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if} {if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2">{l s='Data sheet'}</a></li>{/if} and this a bit further down.. {if isset($features) && $features} <ul id="idTab2" class="bullet"> {foreach from=$features item=feature} {if isset($feature.value)} <li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8'}</li> {/if} {/foreach} </ul> {/if} If you put a comment tag <!-- CODE CODE CODE -->around both of these you'll disable the datasheet completely, but without destroying its function should you need it later. If you need the datasheet, you can try this.. (untested) {if isset($feature.value)} {if $feature.name==name_of_feature} <!-- do nothing --> {else} <li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8'}</li> {/if} {/if} Right, once you've done that you have a new variable that you can call on with a foreach and if statement anywhere.. So back up the top of my file I now have this.. {if isset($features) && $features} <!-- product's additional features --> <ul style="list-style-type: none;"> {foreach from=$features item=feature} {if isset($feature.value)} {if $feature.name==RRP} {if $feature.value > $productPrice} <li>{l s='RRP : '}<span style="text-decoration:line-through;">{convertPrice price=$feature.value}</span></li><br> <li>{l s='You Save : '}{convertPrice price=$feature.value-$productPrice}</li><br> <li>{l s='You Save : '}{round((($feature.value-$productPrice)/$feature.value)*100)}{l s='%'}</li><br> {/if} {else} <li>{$feature.value|escape:'htmlall':'UTF-8'}</li><br> {/if} {/if} {/foreach} </ul> {/if} I haven't formatted it yet so that it displays visually quite the way I want it to, or decided if I like percentages or dollar figures, but here's a pic to show its basically functional.. image uploading site 3 Link to comment Share on other sites More sharing options...
maraveloJewellery Posted February 11, 2014 Share Posted February 11, 2014 Cool but I wish someone would create a module to do this so that I needn't hack core files. Link to comment Share on other sites More sharing options...
jack89 Posted February 27, 2014 Share Posted February 27, 2014 HI there very new to prestashop iv been after an rrp section on my theme for a while iv had a little go at css editing but i am pretty useless, any chance you could simplify it a bit maybe a small tutorial becuase this is exactly what i am looking for sorry to be a pain thanks in advance jack Link to comment Share on other sites More sharing options...
puffdade Posted February 27, 2014 Share Posted February 27, 2014 I like this a lot and as Jack above said Link to comment Share on other sites More sharing options...
Recommended Posts