Announcement

Collapse
No announcement yet.

Variable Trouble

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

    Variable Trouble

    I have a variable called GiftSection which is set to type Text and set at the product level.

    I have this variable in a BlockIf that says:

    GiftSection == "Jewellery"

    This works fine and runs the code in the block if the variable is set to 'Jewellery'

    see:
    http://community.actinic.com/showthread.php?t=39366

    What I really want to do is replace 'Jewellery' with the 'SectionName' variable as I only want to show products in the section of their name.

    If I change the BlockIf to:

    GiftSection == "SectionName"

    I get and invalid expression error, if I remove the quotes it just doesn't work.

    What am I doing wrong?
    Unusual Silver Jewellery
    Giftmill - Unusual Gifts
    Crystal Healing Jewellery
    Steampunk Jewellery

    #2
    That obviously will not work as you have not told SectionName which section to compare to.

    Check out http://community.actinic.com/showpos...9&postcount=18


    Bikster
    SellerDeck Designs and Responsive Themes

    Comment


      #3
      if I remove the quotes it just doesn't work
      I assume you don't get an error but the block doesn't work as you expect.

      The easy way to diagnose this is to display the variables so you can see what's happening.

      E.g. Put in the place you expect to use the blockif just

      GD: GiftSection SN: SectionName<br/>

      And see what displays.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Norman:
        Thanks as usual.

        Displaying the SectionName and GiftSection variables in different places within the blocks shows whats happening.

        The GiftSection variable is working as expected - always displaying the value set. The SectionName variable is displaying the Section Name where the product is rather than the section the block is in.

        Jont:
        Looks like you have hit the nail on the head. I will read through the thread you gave to see if I can place the SectionName part outside of the block, if you see what I mean.
        Unusual Silver Jewellery
        Giftmill - Unusual Gifts
        Crystal Healing Jewellery
        Steampunk Jewellery

        Comment


          #5
          Sorted

          Looks like its all working now.

          Changed:

          GiftSection == "SectionName"

          To:

          Code:
          <actinic:variable name="GiftSection" /> == <actinic:variable name="MainSection::SectionName" />
          Many thanks Norman and Jont
          Unusual Silver Jewellery
          Giftmill - Unusual Gifts
          Crystal Healing Jewellery
          Steampunk Jewellery

          Comment

          Working...
          X