Color swatch and text swatch issue in magento 2How to change the dropdown option on a product page?How to...

How to delegate to implementing class

Can not tell colimits from limits

Are Boeing 737-800’s grounded?

Modify locally tikzset

Is there a way to get a compiler for the original B programming language?

TikZ how to make supply and demand arrows for nodes?

Pulling the rope with one hand is as heavy as with two hands?

When and why did journal article titles become descriptive, rather than creatively allusive?

How to pronounce 'C++' in Spanish

What is the difference between `a[bc]d` (brackets) and `a{b,c}d` (braces)?

Is creating your own "experiment" considered cheating during a physics exam?

Feels like I am getting dragged in office politics

Can fracking help reduce CO2?

get exit status from system() call

What does "rf" mean in "rfkill"?

Were there two appearances of Stan Lee?

Can my Warlock be invisible and attack with its familiar?

How to stop co-workers from teasing me because I know Russian?

What is a Recurrent Neural Network?

What are the spoon bit of a spoon and fork bit of a fork called?

Will tsunami waves travel forever if there was no land?

Was it really necessary for the Lunar Module to have 2 stages?

Stateful vs non-stateful app

Do generators produce a fixed load?



Color swatch and text swatch issue in magento 2


How to change the dropdown option on a product page?How to display crossed swatches for not available sizes in Magento 2?How to get quantity of simple product on configurable product pageMagento 2.1.3 - no Text Swatches on Frontend [SOLVED]Magento 2 - Change Input type of Size attribute cause problem not showingMagneto2 : Add color swatch attribute option with colorcode value programmaticallyprogrammatically add color swatches to color attribute Magento2Can't change dropdown attribute to visual swatch on Magento 2Magento 2 - Setting “Text Swatch” or “Visual Swatch” does not work. Attribute still shows as dropdown on frontendMagento 2 - Set “Text Swatch” or “Visual Swatch” then images does not changed in frontend






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















If I used color and text swatch in magento 2, sequence/order of option isn't changing. I mean I want to show



1. size
2. color


but it always show



1. color
2. size


if I used dropdown instead of color and text swatch. it is working fine.
Can anyone tell me, is that isssue comes with magento 2.0?










share|improve this question
















bumped to the homepage by Community 15 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    4















    If I used color and text swatch in magento 2, sequence/order of option isn't changing. I mean I want to show



    1. size
    2. color


    but it always show



    1. color
    2. size


    if I used dropdown instead of color and text swatch. it is working fine.
    Can anyone tell me, is that isssue comes with magento 2.0?










    share|improve this question
















    bumped to the homepage by Community 15 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      4












      4








      4








      If I used color and text swatch in magento 2, sequence/order of option isn't changing. I mean I want to show



      1. size
      2. color


      but it always show



      1. color
      2. size


      if I used dropdown instead of color and text swatch. it is working fine.
      Can anyone tell me, is that isssue comes with magento 2.0?










      share|improve this question
















      If I used color and text swatch in magento 2, sequence/order of option isn't changing. I mean I want to show



      1. size
      2. color


      but it always show



      1. color
      2. size


      if I used dropdown instead of color and text swatch. it is working fine.
      Can anyone tell me, is that isssue comes with magento 2.0?







      magento2 attributes product-attribute






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 4 '16 at 11:10









      Rohit Kundale

      2,90711327




      2,90711327










      asked Mar 4 '16 at 10:48









      Ravi MuleRavi Mule

      2116




      2116





      bumped to the homepage by Community 15 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 15 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I have same issue just today and able to fix it by changing each attribute key as string by adding any character like "_" in the getJsonConfig result. It seems its a browser or javascript issue where it automatically sort numeric array keys so changing it to string key will prevent it from sorting automatically.



          Testing Solution:
          1. Edit vendormagentomodule-swatchesBlockProductRendererConfigurable.php
          2. Add the below function to override the getJsonConfig:



          public function getJsonConfig() {
          $jsonConfig = parent::getJsonConfig();
          $decodedConfig = json_decode($jsonConfig, true);

          foreach ($decodedConfig['attributes'] as $attributeId => $attributeData) {
          $decodedConfig['attributes']["_" . $attributeId] = $attributeData;
          unset($decodedConfig['attributes'][$attributeId]);
          }

          return $this->jsonEncoder->encode($decodedConfig);
          }


          You have two choices, either use plugin or extend that file. I use plugin for this.



          Hope that helps :)






          share|improve this answer


























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f104705%2fcolor-swatch-and-text-swatch-issue-in-magento-2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I have same issue just today and able to fix it by changing each attribute key as string by adding any character like "_" in the getJsonConfig result. It seems its a browser or javascript issue where it automatically sort numeric array keys so changing it to string key will prevent it from sorting automatically.



            Testing Solution:
            1. Edit vendormagentomodule-swatchesBlockProductRendererConfigurable.php
            2. Add the below function to override the getJsonConfig:



            public function getJsonConfig() {
            $jsonConfig = parent::getJsonConfig();
            $decodedConfig = json_decode($jsonConfig, true);

            foreach ($decodedConfig['attributes'] as $attributeId => $attributeData) {
            $decodedConfig['attributes']["_" . $attributeId] = $attributeData;
            unset($decodedConfig['attributes'][$attributeId]);
            }

            return $this->jsonEncoder->encode($decodedConfig);
            }


            You have two choices, either use plugin or extend that file. I use plugin for this.



            Hope that helps :)






            share|improve this answer






























              0














              I have same issue just today and able to fix it by changing each attribute key as string by adding any character like "_" in the getJsonConfig result. It seems its a browser or javascript issue where it automatically sort numeric array keys so changing it to string key will prevent it from sorting automatically.



              Testing Solution:
              1. Edit vendormagentomodule-swatchesBlockProductRendererConfigurable.php
              2. Add the below function to override the getJsonConfig:



              public function getJsonConfig() {
              $jsonConfig = parent::getJsonConfig();
              $decodedConfig = json_decode($jsonConfig, true);

              foreach ($decodedConfig['attributes'] as $attributeId => $attributeData) {
              $decodedConfig['attributes']["_" . $attributeId] = $attributeData;
              unset($decodedConfig['attributes'][$attributeId]);
              }

              return $this->jsonEncoder->encode($decodedConfig);
              }


              You have two choices, either use plugin or extend that file. I use plugin for this.



              Hope that helps :)






              share|improve this answer




























                0












                0








                0







                I have same issue just today and able to fix it by changing each attribute key as string by adding any character like "_" in the getJsonConfig result. It seems its a browser or javascript issue where it automatically sort numeric array keys so changing it to string key will prevent it from sorting automatically.



                Testing Solution:
                1. Edit vendormagentomodule-swatchesBlockProductRendererConfigurable.php
                2. Add the below function to override the getJsonConfig:



                public function getJsonConfig() {
                $jsonConfig = parent::getJsonConfig();
                $decodedConfig = json_decode($jsonConfig, true);

                foreach ($decodedConfig['attributes'] as $attributeId => $attributeData) {
                $decodedConfig['attributes']["_" . $attributeId] = $attributeData;
                unset($decodedConfig['attributes'][$attributeId]);
                }

                return $this->jsonEncoder->encode($decodedConfig);
                }


                You have two choices, either use plugin or extend that file. I use plugin for this.



                Hope that helps :)






                share|improve this answer















                I have same issue just today and able to fix it by changing each attribute key as string by adding any character like "_" in the getJsonConfig result. It seems its a browser or javascript issue where it automatically sort numeric array keys so changing it to string key will prevent it from sorting automatically.



                Testing Solution:
                1. Edit vendormagentomodule-swatchesBlockProductRendererConfigurable.php
                2. Add the below function to override the getJsonConfig:



                public function getJsonConfig() {
                $jsonConfig = parent::getJsonConfig();
                $decodedConfig = json_decode($jsonConfig, true);

                foreach ($decodedConfig['attributes'] as $attributeId => $attributeData) {
                $decodedConfig['attributes']["_" . $attributeId] = $attributeData;
                unset($decodedConfig['attributes'][$attributeId]);
                }

                return $this->jsonEncoder->encode($decodedConfig);
                }


                You have two choices, either use plugin or extend that file. I use plugin for this.



                Hope that helps :)







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 5 '16 at 10:23









                Qaisar Satti

                27.2k1258110




                27.2k1258110










                answered Apr 5 '16 at 9:57









                znarfznarf

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f104705%2fcolor-swatch-and-text-swatch-issue-in-magento-2%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                    How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                    夢乃愛華...