Announcement

Collapse
No announcement yet.

Using choice to show image

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

    Using choice to show image

    Is it possible to show a list of images directly from an attribute choice list?
    So if the list of choices on a drop down are colours then the colour gif's could be shown automatically somewhere else on the product page.
    Clothing to make an impression.
    www.stitchfactory.co.uk

    #2
    Search Search & Search Again

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

    Don't forget the Knowledge Base when looking for answers

    Army Gore-tex
    Winter Climbing Mitts
    webD's Blog: Website design, SEO and other ramblings…
    Twitter LinkedIN

    If you think a post is good, rate it!

    Find the answers in the Knowledge Base | Have you read the User Guides

    Comment


      #3
      I'm not looking to display next to each radio button and have to select an image for each. I have Norman's plug in for doing that.

      What I want is to pre-define a group of colour images from a supplier with their pantone reference. Red1147 for example and have that as a choice.
      Name Red
      HTML Red1147

      If the colour appears in the list then I want it to show as a swatch next to all the other colours available somewhere on the page without having to select an image for the 700 plus items on the site with up to 48 colours per item.
      Clothing to make an impression.
      www.stitchfactory.co.uk

      Comment


        #4
        Barebones (untested) code:
        Code:
        <actinic:block php="true">$swatchhtml = '';</actinic:block>
        <actinic:block type="AttributeList">
        	<actinic:block type="ChoiceList">
        		<actinic:block php="true">
        			$htmlforname = '<actinic:variable name="ChoiceDisplayLabel" encoding="perl" selectable="false">';
        			$swatchname = $htmlforname . '.jpg';
        			if ( file_exists($swatchname) )
        				{
        				$swatchhtml .= "<img class=\"swatchimage\" src=\"$swatchname\" alt=\"$htmlforname\" title=\"$htmlforname\" />";
        				}
        		</actinic:block>
        	</actinic:block>
        </actinic:block>
        <actinic:block php="true">
        	if ( $swatchhtml != '' )
        		{
        		echo "<div class=\"swatches\">$swatchhtml</div>";
        		}
        </actinic:block>
        Put it into a product layout.

        This looks for files (in your Site folder) called <HTMLForName>.jpg and if found adds it to a block of IMG HTML tags. If any images exist the block is output surrounded by a DIV tag. If no images found nothing is output.

        DIV has classname swatches and images have classname swatchimage so you can set appropriate widths there so the images tile.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Sorry I obviuosly didn't understand your want from the OP.

          Does Norman's code help?

          Army Gore-tex
          Winter Climbing Mitts
          webD's Blog: Website design, SEO and other ramblings…
          Twitter LinkedIN

          If you think a post is good, rate it!

          Find the answers in the Knowledge Base | Have you read the User Guides

          Comment


            #6
            My code should do what Chris wants. N.B. I just amended it to remove a minor typo.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Norman,

              thanks again, it does just what I wanted except it's producing a double image.

              It goes..
              Red,Blue,Red,Blue

              I've tried altering all the code but not knowing much about PHP didn't get far, although I have managed to get it to look in a directory named swatches.
              Attached Files
              Clothing to make an impression.
              www.stitchfactory.co.uk

              Comment


                #8
                webD

                thanks for the reply. It's always good to get an answer whatever.

                Normans code is great and will get colour swatches on the site straight away and much needed colour.
                Clothing to make an impression.
                www.stitchfactory.co.uk

                Comment


                  #9
                  except it's producing a double image
                  I'd need to see a live page to comment on this.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Hi Norman

                    here's a sample page I've uploaded with just Navy & Red colour set.

                    http://stitchfactory.co.uk/acatalog/...bib-apron.html
                    Clothing to make an impression.
                    www.stitchfactory.co.uk

                    Comment


                      #11
                      Inexplicable behaviour. Lets put in some diagnostic code and see what it outputs. Immediately after the line:

                      <actinic:block type="AttributeList">


                      Add

                      IDX: <actinic:variable name="ListIndex" />


                      Then let me see what happens.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Also, I've amended my post #4 above to include a TITLE attribute so that Firefox users can see the swatch name when they mouseover the icon.
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #13
                          I've published the page again with the IDX code to the link as above
                          Clothing to make an impression.
                          www.stitchfactory.co.uk

                          Comment


                            #14
                            Hmmm... That shows that the ATTRIBUTELIST is only being generated once (as it should). Leave that line in for the moment and add another line


                            CIDX: <actinic:variable name="ListIndex" />

                            just below

                            <actinic:block type="ChoiceList">

                            And report when viewable.
                            Norman - www.drillpine.biz
                            Edinburgh, U K / Bitez, Turkey

                            Comment


                              #15
                              Added the line and published as previous link
                              Clothing to make an impression.
                              www.stitchfactory.co.uk

                              Comment

                              Working...
                              X