Announcement

Collapse
No announcement yet.

11.03 Is this a bug? AttributeList and ComponentList in conditions?

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

    11.03 Is this a bug? AttributeList and ComponentList in conditions?

    Just checking our site before upgrading to 11.03 - getting errors on our product layout where I have been using the following condtion

    <actinic:variable name="AttributeList" /> != "" OR <actinic:variable name="ComponentList" /> != ""

    This is for a conditional to display an options tab on those products which have Atrribs or Comps, and not display the tab when they don't.

    It has been working on 11.02.

    Does anyyone else do this, or is there a different way I can check for this?


    Edit: I can get around this my performing the check and writing the html with php but its a bit messy and not easy to amend.

    #2
    I've narrowed this down to ComponentList, when I take this out, no errors.

    Comment


      #3
      Lol replying to my own again!

      It appears that if place the condition in the "block if" directly thus:-


      <actinic:block if="%3cactinic%3avariable%20name%3d%22AttributeList%22%20%2f%3e%20%21%3d%20%22%22%20OR%20%3cactinic%3avariable%20name%3d%22ComponentList%22%20%2f%3e%20%21%3d%22%22" >

      I get the error

      If I place a user defined condition in, it works :-


      <actinic:block if="%3cactinic%3avariable%20name%3d%22Optionscheck%22%20%2f%3e%3d%3dtrue" >

      where Optionscheck =

      <actinic:variable name="AttributeList" /> != "" OR <actinic:variable name="ComponentList" /> !=""

      Comment


        #4
        Hello Rebecca

        I suggest having a word with our support team regarding this, unless the other forum members can suggest something.

        Regards
        Krithika Chandrasekar
        SellerDeck

        sigpic

        E-commerce software by SellerDeck

        Comment


          #5
          Using a complex layout like ComponentList in a Condition is problematic. Conditions act like PHP blocks with the variable values quoted. So code you write like:

          <actinic:variable name="ProductId" /> == "1234"

          When the product ID is ABCD will be interpreted as

          "ABCD" == "1234"

          Which should work fine as this is valid PHP.

          However AttributeList or ComponentList generates a huge lump of HTML that may include quotes, newlines, JavaScript, etc. This won't fit happily into a simple quoted string.

          I'd do it thus:
          Code:
          <actinic:block php="true">
          	$havelist = false;
          	<actinic:block type="AttributeList" />$havelist = true;</actinic:block>
          	<actinic:block type="ComponentList" />$havelist = true;</actinic:block>
          	if ( $havelist )
          		{
          		$html = <<<ENDOFHTML
          	YOUR ATTRIBUTELIST / COMPONENT LIST HTML HERE
          ENDOFHTML;
          		echo $html;
          		}
          	else
          		{
          		$html = <<<ENDOFHTML
          	YOUR PLAIN HTML HERE
          ENDOFHTML;
          		echo $html;
          		}
          </actinic:block>
          You can use Variables and Layouts in the "YOUR...HTML HERE" lines.

          Make sure you don't indent the ENDOFHTML; lines. They must be left aligned.
          Tested this on V11.0.3 and it's fine.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Thanks norman, that was exactly my php workaround. It does makes sense albeit was a bit surprised to find that the original code works in 11.02 and not in 11.03.

            Have another issue with 11.03 as listed in the bugs section so are going to hold on the upgrade until that is fixed (although I may have a look a javascript to see if its anything obvious).


            Edit: It would be really cool if we had a nice variable to detect the presence of either lists.

            Comment


              #7
              V11.0.3 has changed the Attribute / Component layouts and Choice layouts to include some real-time-stock JavaScript. That may have been breaking your existing use of them.

              I've had to tweak a couple of my add-ons to cope with this.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Originally posted by NormanRouxel View Post
                V11.0.3 has changed the Attribute / Component layouts and Choice layouts to include some real-time-stock JavaScript. That may have been breaking your existing use of them.

                I've had to tweak a couple of my add-ons to cope with this.
                Yes that makes sense too, it does seem that both my issues stem from the same thing - the effect of RTS on components. I imagine I could perhaps edit out the javascript for the rts to bring it back inline with 11.02 but I think I'll stick with 11.02 for the time being.

                Comment

                Working...
                X