Quantorum Posted June 27, 2016 Share Posted June 27, 2016 My eshop is offering products with different warranties. Every product has one fixed warranty period, which can range from 24-60 months (I don't allow my customers to choose warranty on their own). I want the warranty to be displayed next to product price, ideally becoming bigger and greener as warranty period extends. What approach would you recommend me to achieve this goal? Yet, I am not aware of capabilities Presta can offer to me and I will be glad for any advice. Regards, Quant. Link to comment Share on other sites More sharing options...
Rolige Posted June 27, 2016 Share Posted June 27, 2016 This feature is not include natively in PrestaShop, you will need a module or a custom development. There are some modules there, but is to extend the warranty. Link to comment Share on other sites More sharing options...
rocky Posted June 28, 2016 Share Posted June 28, 2016 Since you say it's a fixed warranty that can't be changed, I would suggest adding the warranty as a feature. Go to Catalog > Features to create a "Warranty (in months)" feature with values "24", "36", etc, then edit your products and on the "Features" subtab, choose the warranty that applies to the product. It will then display under "Data sheet" on the product page on your website. You could then write code in product.tpl that gets that feature value and then displays it next to the product price. For example, change the following at about line 299: </div> <!-- end prices --> to: {if isset($features) && $features} {foreach from=$features item=feature} {if $feature.id_feature == 1} <span class="warranty{$feature.value|escape:'html':'UTF-8'}">{$feature.value|escape:'html':'UTF-8'}-{l s='month warranty'}</span> {/if} {/foreach} {/if} </div> <!-- end prices --> Change 1 to the ID of the "Warranty (in months)" feature. You can then add CSS like the following to style the warranties: .warranty24 { font-color: #000 } .warranty36 { font-color: #0f0 } I hope this helps. 1 Link to comment Share on other sites More sharing options...
Quantorum Posted June 29, 2016 Author Share Posted June 29, 2016 Wow, I could have imagined, that there is such a elegant solution. I give you a big hand for your help 1 Link to comment Share on other sites More sharing options...
Rolige Posted June 30, 2016 Share Posted June 30, 2016 Good idea rocky, using a feature to warranty. 1 Link to comment Share on other sites More sharing options...
tuhingr Posted January 5, 2019 Share Posted January 5, 2019 On 6/28/2016 at 6:02 AM, rocky said: Since you say it's a fixed warranty that can't be changed, I would suggest adding the warranty as a feature. Go to Catalog > Features to create a "Warranty (in months)" feature with values "24", "36", etc, then edit your products and on the "Features" subtab, choose the warranty that applies to the product. It will then display under "Data sheet" on the product page on your website. You could then write code in product.tpl that gets that feature value and then displays it next to the product price. For example, change the following at about line 299: </div> <!-- end prices --> to: {if isset($features) && $features} {foreach from=$features item=feature} {if $feature.id_feature == 1} <span class="warranty{$feature.value|escape:'html':'UTF-8'}">{$feature.value|escape:'html':'UTF-8'}-{l s='month warranty'}</span> {/if} {/foreach} {/if} </div> <!-- end prices --> Change 1 to the ID of the "Warranty (in months)" feature. You can then add CSS like the following to style the warranties: .warranty24 { font-color: #000 } .warranty36 { font-color: #0f0 } I hope this helps. Looking for product.tpl location and is it working for 1.7? 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