1

This error:
Invalid EE Conditional Variable
Filename: libraries/Functions.php
Line Number: 2761

occurs when I have this code in a BrilliantRetail template:

{items}
<tr>
  <td class="product_info">
    {!--
        Only show the product image for publications or JM fund
    --}
    {if "{sku}" != "CE_FEE" AND  
        (preg_match('/^NOTE/',  "{sku}") OR 
         preg_match('/^PUB/',   "{sku}") OR 
         preg_match('/^EPUB/',  "{sku}") OR
         preg_match('/^JMMRF/', "{sku}")
        )
    }
         <img src="/media/{image_thumb}" title="{title}" alt="{title}" width="100">
    {/if}
    <h5><a href="{exp:brilliant_retail:path src='product/{url_title}'}">{title}</a></h5>
    {options}
  </td>
  <td class="align_center">{price_html}</td>
  <td class="align_center"><input name="qty[{hash}]" class="input_tiny" type="text" value="{quantity}" /></td>
  <td class="align_center">{subtotal}</td>
  <td><a href="{remove_link}">
    <img src="/images/icons/trash.png" alt="Remove" title="Remove Item" /></a>
  </td>
</tr>
{/items}

This only began happening when I upgraded to 2.7.2. Worked perfectly with 2.5.2.

What should I check?

3 Answers 3

2

I see that you have php preg_match but no opening/closing php tags. Are those elsewhere in the code? If not then add opening/closing php tags and see what happens.

2

A good starting point for an error like this is to reduce your code... remove your conditional line by line until you find the offending line.

Also, try this patch posted to a similar EE bug: https://support.ellislab.com/bugs/detail/17989

6
  • I see that you have php preg_match but no opening/closing php tags. Are those elsewhere in the code? - Agree with Anna, best approach would be to simplify the conditional.
    – CreateSean
    Nov 4, 2013 at 17:17
  • As I stated, it has worked flawlessly in my 2.5.2 install for well over a year.
    – MB34
    Nov 4, 2013 at 17:20
  • @MB34 Are the PHP tags elsewhere in the code?
    – Anna_MediaGirl
    Nov 4, 2013 at 17:22
  • No, never needed them before.
    – MB34
    Nov 4, 2013 at 17:26
  • I added them and now it's working.
    – MB34
    Nov 4, 2013 at 17:31
0

Here's the final code:

{items}
    <tr>
        <td class="product_info">
<?php
    if("{sku}" != "CE_FEE" AND (preg_match("/^NOTE/",  "{sku}") OR
                                preg_match("/^PUB/",   "{sku}") OR 
                                preg_match("/^EPUB/",  "{sku}") OR
                                preg_match("/^JRMMF/", "{sku}"))) {
?>
            <img src="/media/{image_thumb}" title="{title}" alt="{title}" width="100">                                     
<?php
    }
?>
            <h5><a href="{exp:brilliant_retail:path src='product/{url_title}'}">{title}</a></h5>
            {options}
        </td>
        <td class="align_center">{price_html}</td>
        <td class="align_center"><input name="qty[{hash}]" class="input_tiny" type="text" value="{quantity}" /></td>
        <td class="align_center">{subtotal}</td>
        <td><a href="{remove_link}"><img src="/images/icons/trash.png" alt="Remove" title="Remove Item" /></a></td>
    </tr>
{/items}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.