Freeform pricing

Post general discussion topics here

Freeform pricing

Postby traveller » Tue Apr 07, 2009 6:42 pm

Never one to make things too easy, I've got another problem. Some of my users dont want to put a number in the price field - they either want 'offers', or 'enquire for price'. Trouble is, if they leave the price field empty, or write text in it, the price shows up as $0.00. Can the price field be modified, so that if text is entered that displays instead of 0?
traveller
 
Posts: 42
Joined: Wed Apr 01, 2009 3:39 pm

Re: Freeform pricing

Postby bkeep » Wed Apr 08, 2009 3:12 am

you can use something like this in the listings.tpl find the sections that display the $records.price
Code: Select all
{if $records.price <= 1} Call for Price{/if}
Best Regards,
Brandon

Web Hosting for as little as $72.00 dollars a year
http://alias454studios.com/hosting.php
Use the code "FIFTY" to get 50% off any hosting package

Open Auto Classifieds Services
http://openautoclassifieds.com/services.php
User avatar
bkeep
Site Admin
 
Posts: 996
Joined: Sun Jan 27, 2008 7:37 am
Location: Freeport, IL

Re: Freeform pricing

Postby traveller » Wed Apr 08, 2009 10:59 am

Worked perfectly, thanks!
traveller
 
Posts: 42
Joined: Wed Apr 01, 2009 3:39 pm

Re: Freeform pricing

Postby get2it » Wed Oct 21, 2009 8:30 am

Yes this works but it is hardly perfect. I am getting this result: "Call for Price $0.00". It doesn't seem to stop $0.00 from showing when the price is less than <= 1 . Is there a way to make this not show the $0.00 when the price field is empty or less than 1? Here's where I inserted this in listings.tpl
Code: Select all
<p class="right-align">
{if $records.price <= 1} Call for Price{/if} {$smarty.const.CURRENCY_SYMBOLS}{$records.price|number_format:2:"`$smarty.const.CURRENCY_SYMBOLS_DECIMAL_SEPARATOR`":
"`$smarty.const.CURRENCY_SYMBOLS_THOUSANDS_SEPARATOR`"}<br />

I have also tried inserting this in other spots in the above code with results of: "$0.00 Call for Price"
get2it
 
Posts: 2
Joined: Wed Oct 21, 2009 7:41 am

Re: Freeform pricing

Postby traveller » Wed Oct 21, 2009 8:42 am

I'm not using this bit at the moment as I've not got anything with 'offers only' but I still have this on a subscribed topic. I'm sure Brandon will know, but here's a suggestion first.
Where you have
Code: Select all
<p class="right-align">
{if $records.price <= 1} Call for Price{/if} {$smarty.const.CURRENCY_SYMBOLS}{$records.price|number_format:2:"`$smarty.const.CURRENCY_SYMBOLS_DECIMAL_SEPARATOR`":
"`$smarty.const.CURRENCY_SYMBOLS_THOUSANDS_SEPARATOR`"}<br />

try
Code: Select all
<p class="right-align">
{if $records.price <= 1} Call for Price {else}{$smarty.const.CURRENCY_SYMBOLS}{$records.price|number_format:2:"`$smarty.const.CURRENCY_SYMBOLS_DECIMAL_SEPARATOR`":
"`$smarty.const.CURRENCY_SYMBOLS_THOUSANDS_SEPARATOR`"}{/if}<br />
traveller
 
Posts: 42
Joined: Wed Apr 01, 2009 3:39 pm

Re: Freeform pricing

Postby get2it » Wed Oct 21, 2009 10:08 pm

That was what it needed to make it work properly. Thanks for the help.
get2it
 
Posts: 2
Joined: Wed Oct 21, 2009 7:41 am

Re: Freeform pricing

Postby traveller » Thu Oct 22, 2009 4:09 am

Yay! On the basis that 'even a blind squirrel finds the odd nut', I knew I'd finally work out a bit of code without needing someone else! Glad it worked for you.
traveller
 
Posts: 42
Joined: Wed Apr 01, 2009 3:39 pm

Re: Freeform pricing

Postby robin302 » Fri Mar 05, 2010 9:30 pm

I have been trying to get this to work but everytime I make changes I get errors. Can someone who has this working copy and paste the entire listings.tpl here or send it to me in a PM? Any help would be appreciated. Thanks!
robin302
 
Posts: 1
Joined: Fri Mar 05, 2010 9:22 pm


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest