Announcement

Collapse
No announcement yet.

Beginner tip: displaying variable values

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

    Beginner tip: displaying variable values

    If like me you are having trouble understanding why an if-block does not show, find the condition in the Library, copy and paste it into your layout. Then break it apart and mark each element. Then when you preview the page you can debug it.

    For example, I wanted the Add to Cart button to appear on the Extended Info Page, but it wasn't.

    The condition is:
    (<Actinic:Variable Name="CatalogIsSuspended"/> == FALSE) AND
    (<actinic:variable name="IsOnlineOrderingAllowed" /> == TRUE) AND
    (<actinic:variable name="IsInStock" /> == TRUE) AND
    (<Actinic:Variable Name="CanBeOrderedOnline"/> == TRUE) AND
    (<actinic:variable name="SingleAddToCartButtonIsUsed" /> == FALSE)

    so putting this into the layout:
    1 <Actinic:Variable Name="CatalogIsSuspended"/>
    2 <actinic:variable name="IsOnlineOrderingAllowed" />
    3 <actinic:variable name="IsInStock" />
    4 <Actinic:Variable Name="CanBeOrderedOnline"/>
    5 <actinic:variable name="SingleAddToCartButtonIsUsed" />

    spat out 1 0 2 1 3 1 4 1 5 1 - revealing that the last one was actually TRUE. A search of Help revealed that Single Add to Cart Button per Page was checked for the Category.

    #2
    I created a new variable called Debug (true or false) at SITE-LEVEL - default = false
    I then surrounded the equivilent of your tests with the new variable and only displayed if the condition is true.
    Just before publishing the site, I make sure that debu=false (again) so that if I accidently left debug statements in the code, they would NOT show up in a live site.

    If you also allow Debug to be changed at fragment, product etc levels, you can turn it on and off at will anywhere in your pages

    Comment

    Working...
    X