David Henry Posted May 13, 2013 Share Posted May 13, 2013 Some of our products dont't have a price, how do we display text instead? For instance instead of displaying "€0" we should display "Call now for a quote". Alternatively, is it possible to hide the price when it's zero? Is this possible? David Link to comment Share on other sites More sharing options...
NemoPS Posted May 14, 2013 Share Posted May 14, 2013 You can do something like this in the template (product.tpl) where the price is displayed. {if $product.price == 0} {l s='Call for a quote'} {/if} Of course, you need to integrate it qith the current price display to avoid showing 0. Link to comment Share on other sites More sharing options...
David Henry Posted May 14, 2013 Author Share Posted May 14, 2013 thanks Nemo, unfortunately that's not working for me no matter what I do, I've taken it this far... {if $priceDisplay >= 0 && $priceDisplay <= 2} <span id="our_price_display">{convertPrice price=$productPrice}<br /><span class="price-vat">{l s='+ VAT.'}</span></span> {elseif $product.price == 0} {l s='Call for a quote'} {/if} But still no joy, it's still displaying the zero price, but at least the page is displaying. I don't really know Smarty that well. D Link to comment Share on other sites More sharing options...
NemoPS Posted May 14, 2013 Share Posted May 14, 2013 Right, I forgot about javascript Product.js, about line 379 var our_price = ''; if (productPriceDisplay > 0) { our_price = formatCurrency(productPriceDisplay, currencyFormat, currencySign, currencyBlank); } else { our_price = formatCurrency(0, currencyFormat, currencySign, currencyBlank); } $('#our_price_display').text(our_price); Put a condition here, do the text substitution only if the price is not 0. THis should fix it Link to comment Share on other sites More sharing options...
David Henry Posted May 14, 2013 Author Share Posted May 14, 2013 thanks Nemo1, I've found that code but to be honest I've no idea what to add there, I'm not a coder so don't speak javascript. All I'm doing is breaking things which is not a good approach. David Link to comment Share on other sites More sharing options...
NemoPS Posted May 14, 2013 Share Posted May 14, 2013 Okay, try this then var our_price = ''; if (productPriceDisplay > 0) { our_price = formatCurrency(productPriceDisplay, currencyFormat, currencySign, currencyBlank); } else { our_price = formatCurrency(0, currencyFormat, currencySign, currencyBlank); } if(our_price != 0) $('#our_price_display').text(our_price); And in the template {if $priceDisplay >= 0 && $priceDisplay <= 2} {if $product.price !=0} <span id="our_price_display">{convertPrice price=$productPrice}<br /><span class="price-vat">{l s='+ VAT.'}</span></span> {elseif $product.price == 0} {l s='Call for a quote'} {/if} {/if} Link to comment Share on other sites More sharing options...
razvy Posted January 26, 2015 Share Posted January 26, 2015 Hi, Did you fix this? I need that too. If price = 0 I want to show "Product available soon". I tried what you wrote in this post but it didn't work... Link to comment Share on other sites More sharing options...
NemoPS Posted January 28, 2015 Share Posted January 28, 2015 Did it spawn any error? It should work really, maybe you didn't clear cache? Link to comment Share on other sites More sharing options...
ukbaz Posted December 9 Share Posted December 9 Any way to do this in v1.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