Announcement

Collapse
No announcement yet.

Blockif will not work as I expect

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Blockif will not work as I expect

    Hi.

    I have a custom variable IsPricinjgShown (PriceEnabled Tick Box is not controllable from csv import! Ugh!)

    If my Variable is True it should display the Prices.

    If my variable is False, I want it to show the Actinic Vartable ProductPriceNotEnabledMessage.

    However, when the Variable is False, it shows both the ProductPriceNotEnabledMessage & the Pricing!

    Can't fathom out why...

    Ian<actinic:block if="%3cactinic%3avariable%20name%3d%22IsPricingShown%22%20%2f%3e%20%3d%3d%20%22False%22" >
    <actinic:variable name="ProductPriceNotEnabledMessage" />
    </actinic:block>


    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPricingShown%22%20%2f%3e" >
    <actinic:variable name="PriceLayout" />
    </actinic:block>

    Thanks... anyone....
    Ian
    Ian Henley

    #2
    Your first blockif is wrong.
    Code:
    <actinic:variable name="IsPricingShown" /> == "False"
    You are comparing your variable with a string "False" not the false value. Use just false without quotes. Or let the Condition editor do the work using its drop-down code snippets.

    I tend to use the simpler:
    Code:
    ! <actinic:variable name="IsPricingShown" />
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks

      Hey, Norman.
      Thanks for that.
      Is the whole BlockIf covered in greater detail anywhere other than the stnd Docs? I could do with the full works explanantion on BlockIfs.

      Cheers
      Ian
      Ian Henley

      Comment


        #4
        There's a tutorial on http://community.sellerdeck.com/showthread.php?t=35126

        And the other thing to remember is that BlockIf''s are actually PHP bits of code with text variables presented as though they were in quotes, logical and numeric variables are treated as unquoted.

        You can use PHP within blockif's. So to test if something is modulus 4, just use:

        (ListIndex % 4) == 0

        Or in longhand (ready to paste into the Condition editor):

        (<actinic:variable name="ListIndex" /> % 4) == 0

        You don't need any <actinic:block php="true">...</actinic:block> tags. Just the code above. Blockif's are inherently PHP true. Built-in PHP functions can also be used.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X