Jump to content

How to display product warranty?


Quantorum

Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...