This is a discussion on What the {if} am I doing wrong? within the v3.1 Modules & Modifications forums, part of the v3.1 Legacy Help & Support category; I'm trying to modify the code in step 3 of checkout to always list the items with ($0.00 ) cost ...
|
|||||||
|
|
LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
I'm trying to modify the code in step 3 of checkout to always list the items with ($0.00 ) cost that are included in a package as the default choice in the drop down list. But, I want the choice to default to "No Thanks" if there is an addition charge for the item. That way the free features that are included in the package are always selected for the user during checkout and not the ones that require extra payment.
The code below is for the "featured ad" list box but the logic should apply to the "bold" and "Highlighted" drop down lists as well. Could someone look at the code below and see why it won't work? It always drops to the 'else' options. I have only changed the code between the comments. Thanks! Code:
{if $featured=="Y"}
<tr>
<td class="formleft">{$smarty.const.LANG_ADD_FEATURED}{$smarty.const.LANG_COLON}</td>
<td class="formright">
({$cFeaturedPrice}) <select name="featured">
<!-- Default to free features -->
{if $cFeaturedPrice=="$0.00 "}
<option value="Y">{$smarty.const.LANG_YES} (+{$cFeaturedPrice})</option>
<option value="N">{$smarty.const.LANG_NO_THANKS}</option>
{else}
<option value="N">{$smarty.const.LANG_NO_THANKS}</option>
<option value="Y">{$smarty.const.LANG_YES} (+{$cFeaturedPrice})</option>
{/if}
<!-- END Default to free features -->
</select>
</td>
</tr>
{/if}
__________________
V3.1.5 Designer "I have not failed. I've just found 10,000 ways that won't work." THOMAS ALVA EDISON Last edited by BigOrange; 08-16-2008 at 12:25 PM. |
|
#2
|
||||
|
||||
|
Hi. Maybe it is something to do with the $ and the extra blank space in the IF statement. Perhaps try
{if $cFeaturedPrice=="0.00"} |
|
#3
|
||||
|
||||
|
Quote:
Thanks for your help! Any other suggestions are welcomed.
__________________
V3.1.5 Designer "I have not failed. I've just found 10,000 ways that won't work." THOMAS ALVA EDISON |
|
#4
|
||||
|
||||
|
I would recommend putting {debug} var in that template then a smarty popup should appear with the value it is looking for.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | Twitter |
|
#5
|
||||
|
||||
|
Quote:
Here was the problem: {if $cFeaturedPrice=="$0.00"} Here was the solution: {if $cFeaturedPrice=='$0.00'} Using single quotes instead of double made it work correctly. I'm surprised I wasn't getting an error message. Thanks for your help!
__________________
V3.1.5 Designer "I have not failed. I've just found 10,000 ways that won't work." THOMAS ALVA EDISON |
|
#6
|
||||
|
||||
|
Ahh yes. I didn't even look at the quotes.
With double quotes: "$0.00" it thinks the $ is a variable. With single quotes: '$0.00' it doesn't. You could probably also do this: "\$0.00" to escape the dollar sign.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | Twitter |
|
#7
|
||||
|
||||
|
I have a similar problem with the function.new_listings.php plugin. I'm trying to show a camera icon if a listing has photos and nothing if the listing has no photos. The variable I'm trying to use is $entry.image but I'm not sure it is correct. The code I have added has comments that end in RLB.
If you can offer any help it would be appreciated. Thanks for the great support! PHP Code:
__________________
V3.1.5 Designer "I have not failed. I've just found 10,000 ways that won't work." THOMAS ALVA EDISON Last edited by BigOrange; 08-19-2008 at 07:45 PM. |
|
#8
|
||||
|
||||
|
I think this is your problem:
if ($entry.image != " ") Should be: if ($entry.image != "")
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | Twitter |
|
#9
|
||||
|
||||
|
That doesn't work either. I'm wondering if $entry.image is what I should be testing for.
When I try doing the opposite test [ if ($entry.image == "") ] the camera Icon never shows, even for ads that have photos. It's like I'm testing for the wrong variable or one that is not available in the function.new_listings.php plugin. Any other ideas why it doesn't work? PHP Code:
__________________
V3.1.5 Designer "I have not failed. I've just found 10,000 ways that won't work." THOMAS ALVA EDISON |
|
#10
|
||||
|
||||
|
It will probably be easier if you just paste the whole file. I think what I need to see is not included with your first code paste.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | Twitter |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My 68c modification story..Tell me if I'm wrong | GPM55 | Off Topic | 16 | 04-18-2008 12:03 AM |
| does 68 classified have a wrong login time out | lorenww | v3.1 Questions & Support | 5 | 10-12-2007 07:09 PM |
| Navigation points to the wrong directory | BABBSELA | v3.1 Questions & Support | 9 | 11-16-2006 03:44 PM |
| Wrong status (active, inactive) for renewed ads with options | pat01 | v3.1 Questions & Support | 0 | 07-29-2006 05:05 AM |
| Wrong email caused an error | igor81 | Off Topic | 0 | 04-25-2006 08:21 AM |