Announcement

Collapse
No announcement yet.

Changing the order of permutation choices

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

    Changing the order of permutation choices

    Does anyone know if there is a way of altering the order of choices in the drop down box?

    You can alter the order in the content tree but the order in the list given to the customer is that set by the first time you 'Fill the List' in Permutations. I can't alter this order and any new choices are added at the bottom.

    It seems the only way is to delete the whole list and re-fill it after you have ordered the list as you want in the Content Tree, which is not great when you have long lists such as here :-
    http://www.quantumelectronics.co.uk/...m_Builder.html

    Any work arounds or ideas would be appreciated
    www.quantumAV.co.uk
    Home Cinema Receivers and Speakers for Audio Visual Entertainment
    Authorised Dealers for Yamaha/ Monitor Audio/ Kef/ Onkyo/ Marantz/ Denon/ and more..

    #2
    I have the same problems, Andrew
    I've not found a way round it so would be very interested to know if anyone else has!
    Tracey

    Comment


      #3
      Support seem to think it can't be done but have added it to the Wish List.
      www.quantumAV.co.uk
      Home Cinema Receivers and Speakers for Audio Visual Entertainment
      Authorised Dealers for Yamaha/ Monitor Audio/ Kef/ Onkyo/ Marantz/ Denon/ and more..

      Comment


        #4
        it can be done, but we're talking some serious javascript.

        my approach would be to create an array using the items normally used to build the list, then sort this array, then use it to write out a drop down.

        norm used to have a sweet hack for swapping images on dropdowns, by appending the image name to the dropdown with a pipe delimiter at the end.

        i suppose you could use such a delimiter to choose the order too.

        Comment


          #5
          Originally posted by gabrielcrowe View Post
          it can be done, but we're talking some serious javascript.

          my approach would be to create an array using the items normally used to build the list, then sort this array, then use it to write out a drop down.

          norm used to have a sweet hack for swapping images on dropdowns, by appending the image name to the dropdown with a pipe delimiter at the end.

          i suppose you could use such a delimiter to choose the order too.
          Gabe, I love you but you lost me at "serious javascript"
          Tracey

          Comment


            #6
            Me Too!
            (The serious Javascript part )
            Kind Regards
            Sean Williams

            Calamander Ltd

            Comment


              #7
              Serious Javascript - I heard that!

              Here's a way to do this.

              Drop-down Choices will be sorted alphabetically if a variable SortedChoices is set for that Attribute.

              Create an Attribute level Variable as per the attached screenshot.

              In the Drop Down list layout / Start of List replace all code with:
              Code:
              <select <actinic:block if="%3cactinic%3avariable%20name%3d%22SortedChoices%22%20%2f%3e">id="<Actinic:Variable Name="UIWidgetName" />" </actinic:block>name="<Actinic:Variable Name="UIWidgetName"/>" class="form_input_general">
              In the Drop Down list layout / End of List replace all code with:
              Code:
              </select>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SortedChoices%22%20%2f%3e"><script type="text/javascript">sortoptions('<Actinic:Variable Name="UIWidgetName" encoding="perl" selectable="false" />');</script></actinic:block>
              And put this into the HEAD area of your overall layout
              Code:
              <script type="text/javascript">
              function sortoptions(selid){
              	var opts = document.getElementById(selid).options;
              	var optbits = new Array();
              	for (var i=0; i<opts.length; i++)optbits.push(opts[i].text + '||' + opts[i].value); 
              	optbits.sort();
              	for (i=0; i<opts.length; i++)
              		{
              		var bits = optbits[i].split('||');
              		opts[i].text = bits[0];
              		opts[i].value = bits[1];
              		} 
              	document.getElementById(selid).selectedIndex=0;
              }
              </script>
              So choices whose Attribute has SortedChoices set to true will display sorted and others will remain unaltered.
              Attached Files
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Norman, can I just confirm, before I try this, what it's supposed to do?
                Is it re-ordering the dropdown based on the order of the choices in the content tree rather than the order of the permutations list or have we deviated off track?

                (I feel like I fell into an alternate reality when Gabe wandered in LOL)
                Tracey

                Comment


                  #9
                  Could you not also tackle this client site within the actinic database?
                  Not on Actinic machine at present, but I'm sure the ProductProperties table has permutations (have typeID of 8) ordered by a field called nSequence.

                  It would take some wiggly SQL but the psuedo logic would be something like:
                  Loop through product table
                  For each product get permutations for product into array, sort, then update new nSequence back to database
                  Fergus Weir - teclan ltd
                  Ecommerce Digital Marketing

                  SellerDeck Responsive Web Design

                  SellerDeck Hosting
                  SellerDeck Digital Marketing

                  Comment


                    #10
                    what it's supposed to do
                    Fair Question. It automatically sorts the Choices in a drop-down list alphabetically.

                    I've updated my post #7 to allow us to turn this capability on or off via a variable SortedChoices that you can set for each Attribute. The default being to leave things as they were - you have to enable this for specific Attributes before anything happens.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      Originally posted by fergusw View Post
                      For each product get permutations
                      each permutation is stored in a rather contrived manner. this type of script has the possibility of screwing up the database table related to permutations.

                      all this really needs, is a 'display order' in the permutation.

                      perhaps its time actinic catalog got rid of those windows 3.1 style plusses in the top left of lists?

                      Comment


                        #12
                        hah, and as per usual, norm has the code

                        you're a star mr norm.

                        Comment


                          #13
                          Originally posted by NormanRouxel View Post
                          Fair Question. It automatically sorts the Choices in a drop-down list alphabetically.

                          I've updated my post #7 to allow us to turn this capability on or off via a variable SortedChoices that you can set for each Attribute. The default being to leave things as they were - you have to enable this for specific Attributes before anything happens.
                          Thanks for the clarification, Norman.
                          Tracey

                          Comment


                            #14
                            Note that post #7 is for simple Drop Down Choice Lists.

                            If you want to use this on Drop Down Permutation Lists then follow this post instead.

                            Drop-down Choices used within Components / Permutations will be sorted alphabetically if a variable SortedChoices is set for their Attribute.

                            Create an Attribute level Variable as per the attached screenshot.

                            In the Drop Down Permutation List layout / Start of List replace all code with:
                            Code:
                            <select <actinic:block if="%3cactinic%3avariable%20name%3d%22SortedChoices%22%20%2f%3e">id="<actinic:variable name="PermutationAttributeList" value="Attribute IDs" />" </actinic:block>name="<actinic:variable name="PermutationAttributeList" value="Attribute IDs" />" class="form_input_general">
                            <actinic:BLOCK if="%3cactinic%3avariable%20name%3d%22ComponentIsOptional%22%20%2f%3e%20AND%20%3cactinic%3avariable%20name%3d%22IsUsedNoneChoiceLabel%22%20%2f%3e%20AND%20%21%3cactinic%3avariable%20name%3d%22IsSelectedByDefault%22%20%2f%3e" >
                            <option value="-1">
                            	<actinic:variable name="NoneChoiceLabel" />
                            </option>
                            </actinic:block>
                            In the Drop Down Permutation List layout / End of List replace all code with:
                            Code:
                            <actinic:BLOCK if="%3cactinic%3avariable%20name%3d%22ComponentIsOptional%22%20%2f%3e%20AND%20%3cactinic%3avariable%20name%3d%22IsUsedNoneChoiceLabel%22%20%2f%3e%20AND%20%3cactinic%3avariable%20name%3d%22IsSelectedByDefault%22%20%2f%3e" >
                            <option value="-1">
                            	<actinic:variable name="NoneChoiceLabel" />
                            </option>
                            </actinic:block>
                            </select>
                            <actinic:block if="%3cactinic%3avariable%20name%3d%22SortedChoices%22%20%2f%3e"><script type="text/javascript">sortoptions('<actinic:variable name="PermutationAttributeList" value="Attribute IDs" encoding="perl" selectable="false" />');</script></actinic:block>
                            And put this into the HEAD area of your overall layout
                            Code:
                            <script type="text/javascript">
                            function sortoptions(selid){
                            	var opts = document.getElementById(selid).options;
                            	var optbits = new Array();
                            	for (var i=0; i<opts.length; i++)optbits.push(opts[i].text + '||' + opts[i].value); 
                            	optbits.sort();
                            	for (i=0; i<opts.length; i++)
                            		{
                            		var bits = optbits[i].split('||');
                            		opts[i].text = bits[0];
                            		opts[i].value = bits[1];
                            		} 
                            	document.getElementById(selid).selectedIndex=0;
                            }
                            </script>
                            So Permutation Choices whose Attribute has SortedChoices set to true will display sorted and others will remain unaltered.
                            Norman - www.drillpine.biz
                            Edinburgh, U K / Bitez, Turkey

                            Comment


                              #15
                              Guys, thanks for the suggestions.

                              One question though - If you want to order by something other than 'alphabetical' what would you do?

                              Is there a simple way of simply sorting it by the order they are in the content tree? As then you would have the flexibility to order it any way you want. The list I used as an example above is ordered by Range and then Price which is easy to do in the content tree.
                              www.quantumAV.co.uk
                              Home Cinema Receivers and Speakers for Audio Visual Entertainment
                              Authorised Dealers for Yamaha/ Monitor Audio/ Kef/ Onkyo/ Marantz/ Denon/ and more..

                              Comment

                              Working...
                              X