Announcement

Collapse
No announcement yet.

Setting a variable's value to a variable

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

    Setting a variable's value to a variable

    Christmas has come and gone and I'm back to work, which can only mean two things: the mere sight of turkey makes me nauseous and I'm struggling with Actinic.

    I've just started to understand layouts and variables, and though I've got a long way to go yet, I'm really excited about how they can be used. We were doing very similar things in V7 using CUSTOMVARs, but a lot of this was based on manual entry. Our templates were all CUSTOMVAR based too, so V8's inclusion of actual modular layouts and conditional blocks is a welcome addition.

    We're trying to switch over to the variable system now but I'm having a couple of issues. What I'm trying to achieve is a variable that exists through three levels of the store that is set in the parent section. So we'd have:

    Code:
    Parent > Subsection > Product
    Where the product and the subsection would inherit their values from the parent section. Obviously, this is accomplished really very easily by setting the variable to Use Parent().

    However, the value of the parent needs to be set by a variable itself: the parent's section name. I'm not sure if this is possible, but I thought if anybody would know, it would be the forums.

    I'm sure it's something really obvious that I've overlooked, but I'm new to all this variable business and so far have just been ticking things until it works. Any advice is much appreciated.

    #2
    As far as I know these Variables are read only.

    You can only set them by changing them in Actinic or by Importing new values.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks for the reply Norman. Sorry, I don't think I phrased the problem very well. I don't need to alter the contents of the variables at the top level; they contain exactly what I'm after. What I'm trying to do is to get these to propagate down into the product, so that the variable in the product will contain the value set in the parent section, as will the subsection.

      Hope that's a little more clear.

      Comment


        #4
        I read this as - I don't want the top level value to always propogate down - I want to be able to automatically display the parent Section name in a Products details.

        If that's so you can do it via PHP.

        Edit Layout Compact Parent Section Link and add the following
        Code:
        <actinic:block php="true">
        $parent = '<actinic:variable name="SectionName" encoding="perl" selectable="false" />';
        </actinic:block>
        Now in your product layouts add
        Code:
        <actinic:block php="true">
        echo $parent;
        </actinic:block>
        This works because Compact Parent Section Link is used to create the "Breadcrumb Trail". This has an entry for each parent section. The variable $parent gets overwritten with each parent section name in turn, leaving it containing the last parent section name. The product details are displayed further down the page so the $parent value can be used there.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Wow, thanks Norman, that's brilliant. I'll give it a go this morning and see how it works out.

          Comment

          Working...
          X