Q:

Conditional variable error

I previously asked a question about this, but the question itself has kind of changed, and I don't know if anyone's still following it to begin with.
This is the error I'm seeing:

[06-May-2013 10:50:12] PHP User Warning: Invalid EE Conditional
  Variable: {if "N"original"$1.50" != ""} in
  C:\gitRepo\qo5phi\system\expressionengine\libraries\Functions.php on
  line 2843

I found that the error was being thrown by a custom exception built into expression engine that will do partial matches on variable names if it doesn't find the original one. 
From libraries/Functions.php:
// There is a partial variable match being done
// because they are doing something like segment_11
// when there is no such variable but there is a segment_1
// echo  $x[$j]."\n<br />\n";
trigger_error('Invalid EE Conditional Variable: '.$matches[0][$i], E_USER_WARNING);

So in certain iterations of the loop, it's not finding deal_original_price, so it's trying to do a partial match and is finding deal, which evaluates to N in these cases. (As is indicated by the error message.)
I don't know why it's even trying to evaluate deal_original_price in these cases, though, because the entire conditional call is inside another conditional that only runs if deal is Y.
{if deal == "Y" AND coupon == "N"}
    <tr data-deal_id="{deal_id}">
        <td class="productPrice" style="vertical-align: top;">${deal_total}<br />
             <!-- this next line is the one throwing the error -->
            {if deal_original_price && deal_original_price != "" && deal_original_price <> deal_total}
                <span class="originalDealPrice">${deal_original_price}</span><br /><span id="modal_change">Why is there a price difference?</span>
            {if:else}
                <span id="modal_same">Pricing Terms & Conditions</span>
            {/if}
        </td>
    </tr>
{/if}

Any ideas?

A:

What finally worked for me was this:
Instead of using a long conditional containing variables that have similar names to others, I did my conditional processing in my controller and passed back a variable that already knows the answer.
From this:
{if deal_original_price && deal_original_price != "" && deal_original_price <> deal_total}

To this:
  {if costChange == 1}

I also renamed all of my variables to be completely original - i.e. not share ANY part of the variable name with any other variable. I'm sure it's a hack that will have EE gurus yelling, but sometimes you just need to do what works.

