Support Forums

Replace $0.00 if no price entered

This is a discussion on Replace $0.00 if no price entered within the Technical Support forums, part of the Technical Support Forums category; I found several threads in the V3 questions on how to not show $0.00 if no price is entered when ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 04-23-2008, 08:28 PM   #1
Member
 
Join Date: Mar 2006
Posts: 26
Rep Power: 21
topbidz is on a distinguished road
Default Replace $0.00 if no price entered

I found several threads in the V3 questions on how to not show $0.00 if no price is entered when listing an ad. There were so many it was actually hard to follow.

Can anyone tell me how to do this in V4? For example if a person lists a garage sale and does not enter anything in the price field, the field will be blank when the listing is viewed, or maybe replace the $0.00 with text or ...... or anything else that you wanted to display.
topbidz is offline  
Old 04-23-2008, 10:14 PM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,392
Rep Power: 135
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Removing the Price Field
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 04-24-2008, 09:41 AM   #3
Member
 
Join Date: Mar 2006
Posts: 26
Rep Power: 21
topbidz is on a distinguished road
Default

Hi Larry

I appreciate the help. I went to the thread above and was able to figure out the viewlisting.tpl code change OK. I works fine now.

I was not able to do the same thing with the showlistings.tpl code, though. The code I have in my file is slightly different than what is listed in the thread.

This is what I did with the viewlisting.tpl to get it to work:
changed: $price|format_money to: $price|format_money|replace:'$0.00':'No Price Listed' and it worked fine.



This is what I did with showlistings.tpl.
changed: $entry.price|format_money to: $entry.price|format_money|replace:'$0.00':'No Price Listed' but it had no effect.

Any idea what I did wrong?

Thanks

John
topbidz is offline  
Old 04-24-2008, 10:07 AM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,392
Rep Power: 135
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by topbidz
Hi Larry

I appreciate the help. I went to the thread above and was able to figure out the viewlisting.tpl code change OK. I works fine now.

I was not able to do the same thing with the showlistings.tpl code, though. The code I have in my file is slightly different than what is listed in the thread.

This is what I did with the viewlisting.tpl to get it to work:
changed: $price|format_money to: $price|format_money|replace:'$0.00':'No Price Listed' and it worked fine.



This is what I did with showlistings.tpl.
changed: $entry.price|format_money to: $entry.price|format_money|replace:'$0.00':'No Price Listed' but it had no effect.

Any idea what I did wrong?

Thanks

John
What template are you using?
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 04-24-2008, 10:58 AM   #5
Member
 
Join Date: Mar 2006
Posts: 26
Rep Power: 21
topbidz is on a distinguished road
Default

I am using the default template for V4.
topbidz is offline  
Old 04-24-2008, 11:25 AM   #6
curmudgeon
 
Join Date: Mar 2006
Posts: 5,392
Rep Power: 135
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

The dollar sign is not part of the variable. If you use the debug console you will se that the value of price for 0 is 0.00 so if you are looking to replace $0.00 itwont be found.

try

$entry.price|format_money|replace:'0.00':'No Price Listed'

keep in mind though that this will likely display

$No Price Listed

What I would probably do is something like this......

{if $sDisPrice == "Y"}
<td{if $entry.class<>""} class="{$entry.class}"{/if}>
{if $entry.price=="0.00"}
{$entry.price|replace:'0.00':'No Price Listed'}
{else}
{$entry.price|format_money}
{/if}
</td>
{/if}
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 04-24-2008, 01:06 PM   #7
Member
 
Join Date: Mar 2006
Posts: 26
Rep Power: 21
topbidz is on a distinguished road
Default

That took care of everything except the featured listings displayed on the homepage. It is still showing as $0.00. I have looked all over and can't seem to find where to take care of that. Did I miss something?

Thanks

John
topbidz is offline  
Old 04-24-2008, 01:36 PM   #8
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 133
Eric Barnes is just really nice Eric Barnes is just really nice
Default

The featured listings come from a smarty plugin. You would have to edit the php code and it is found in includes/classes/smarty/plugin/function.featured_listing_horizontal.php or vertical.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 04-24-2008, 01:40 PM   #9
curmudgeon
 
Join Date: Mar 2006
Posts: 5,392
Rep Power: 135
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Thats handled by a smarty plugin which is called with the following line at the bottom of home.tpl

{feature_listings_horizontal number=8 cols=4 table_attr='width="100%" cellpadding="3" cellspacing="3"' td_attr='style="border-top: 1px dashed #999;"'}

The file thats called is

/includes/classes/smarty/plugins/function.feature_listings_horizontal.php


You should be able to just add a variable to the line that calls the function and tell it to not display prices at all like this.....

{feature_listings_horizontal number=8 cols=4 show_price=N table_attr='width="100%" cellpadding="3" cellspacing="3"' td_attr='style="border-top: 1px dashed #999;"'}

If you absolutely want price displayed and alter it based on its value you will need to edit the function itself.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 04-24-2008, 10:00 PM   #10
Member
 
Join Date: Mar 2006
Posts: 26
Rep Power: 21
topbidz is on a distinguished road
Default

Hi Larry

I would like to be able to use the price field and alter it but I am afraid editing the function is way over my head so I believe I will quit while I am ahead. Everything you sent me is working great. I appreciate all of the help and support and can't thank you enough!
topbidz is offline  
Closed Thread

Thread Tools
Display Modes



All times are GMT -4. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0