Announcement

Collapse
No announcement yet.

drop down list manipulation

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

    drop down list manipulation

    Hi All
    I know I can link to a product from anywhere but is it possible to show a specific choice from an attribute of that product when the attribute is a dropdown list instead of the first choice? Additionally I would like to show a popup image when the user selects between different choices in this list. I can do this with javascript outwith actinic however I'm having problems getting it to work within.
    Anyone Help.

    #2
    There is one possible solution here which involves putting the code for images within the 'HTML for Name' field of a set of radio buttons.

    The HTML for Name field can also be used to add values in the drop-down list. Whether or not Javascript could read these and act upon them is another matter.

    Comment


      #3
      Thanks for that, I did look at that post before however I have a list of over a hundred choices therefor the check box isn't an option.
      Can I force actinic to use the choice name for the option value instead of the numbers it generates, if so I may be able to create a solution.

      Comment


        #4
        Unfortunately not. These choice values are all hard-wired into the online cart and checkout so it is not possible to get access to them.

        Comment


          #5
          If you fancy doing this another way I've a set of extensions to Actinic that auto create an image map from the list of choices.

          You include a single big image containing a matrix of thumbnails of your choices and the appropriate choice is selected when you click that particular bit of the image.

          See http://www.drillpine.biz/aura/acatal...izes_Demo.html for a demo and http://www.rouxel.cwc.net/actinicstuff.html for details.

          Norman
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            I did see this extension before however with the number of options I have it would look messy. I had hoped there would be other solutions. I will have to go and have a rethink. Thanks for the help.

            Comment


              #7
              I managed to adapt an existing hack to do what you need. Try this:-


              Code:
              Displaying a pop up image (or other info) when a drop down choice is selected.
              You put the additional information into the "HTML for Name" field of each choice
              within round brackets ( ).
              
              e.g.  Left Handed (leftimage.jpg) Operation
                    Right Handed (rightimage.jpg) Operation
              
              The information within the brackets will be hidden from display and stored in an array.
              The stored item will be available in the JavaScript routine showimage whenever a choice is selected.
              Note:-  You should not use the single quote ' character in any of your choices "HTML for Name" fields.
              
              
              Put the following code into Act_primary.html (just above the <BODY> tag).
              
              
              
              <script language=JavaScript>
              function setchoice(choicename){
               var thisimage = '';
               var result = choicename.match(/(.*)\((.*)\)(.*)/);  // see if HTML for Name contains (.....)
               if ( result != null )
                 {
                 document.write(result[1] + result[3]);	// hide the embedded image
                 thisimage = result[2];      			// the text within ( )
                 }
               else
                 {
                 document.write(choicename);  		// the unaltered choice text
                 }   
              
               eval(current + '[' + base++ + '] = \'' + thisimage + '\'');  // save the image name
              }
              
              function showimage(value){
               if ( value != '' )
                 {
                 alert(value);			// your own code here
                 }
              }
              </script>
              
              
              
              
              You should change the code in showimage to do whatever you need.
              
              Replace Act_VariantListHeader with the following code:-
              
              
              
              <!-- VariantListHeader HTML begin -->
              <!-- This template is used for a product variant list box header. -->
              
              <script language=JavaScript>
               var imgNETQUOTEVAR:ATTRIBUTEREF = new Array();
               var current = 'imgNETQUOTEVAR:ATTRIBUTEREF';
               var base = 1;
              </script>
              
              <SELECT NAME="NETQUOTEVAR:ATTRIBUTEREF" onchange="showimage(imgNETQUOTEVAR:ATTRIBUTEREF[this.value])">
              
              <!-- This template is used for a product variant list box header. -->
              <!-- VariantListHeader HTML end -->
              
              
              
              
              Replace Act_VariantListChoice.html with the following code:-
              
              
              
              <!-- VariantListChoice HTML begin -->
              <!-- This template is used for a product variant list box choice. -->
              
              <OPTION VALUE=NETQUOTEVAR:CHOICESELVALUE NETQUOTEVAR:ITEMSELECTED>
              
              <script language=JavaScript>
               setchoice('NETQUOTEVAR:CHOICENAME');
              </script>
              
              <!-- This template is used for a product variant list box choice. -->
              <!-- VariantListChoice HTML end -->
              
              
              Update and that's that.
              
              The code above works on live sites.   It may fail when previewing.
              Norman
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Hi
                Thanks for the excellent response however I cannot get the code to work properly. If I put it into the pages as you describe the drop downs are blank but I have discovered if I comment out the eval line the dropdowns are populated! I'm no javascript guru so cant figure this out. Can you help me again or do you have a site where this code is used?

                Thanks again

                Andrew

                Comment


                  #9
                  Do your image names have arithmetic characters in them e.g. "-"? If so try using just textual image names.

                  Norman
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    Sorry about that. Your reply led me straight to it.

                    It's the darn forum munging the pasted in code (even within CODE tags).

                    It seems to be displaying backslash escaped characters instead of showing the backslash and then the following character as written. Not very useful on a technical forum.

                    I've attached the relevant file instead. I also added a tiny bit to make it fail-safe on non-JavaScript browsers.

                    If anyone else is reading the thread don't use the info posted a few entries above. Use this attached file instead.

                    Norman
                    Attached Files
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      BRILLIANT!
                      Thats fantastic. The noscript code displays the choice twice but I'll leave it out for now.
                      Thanks again
                      Andrew

                      Comment


                        #12
                        The noscript code displays the choice twice but I'll leave it out for now
                        Wierd! Try it with capitals.

                        Norman
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment

                        Working...
                        X