Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7836459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:10:21+00:00 2026-06-02T14:10:21+00:00

After a paid integration between our E-Commerce system and POS system, my online store

  • 0

After a paid integration between our E-Commerce system and POS system, my online store is now showing sizes in Alphabetical/Chronological order.
Eg.
L | M | S | XL instead of S | M | L | XL
And

7 | 7 1/2 | 7 1/4 | 7 1/8 | 7 3/8

This is because the size attributes/options are now being pulled from the POS system and is unique for each product (silly, I know but that’s how the integration works). This means that it’s not possible to manually select the order for them to appear as this will require thousands of manual changes which defeats the purpose of the integration.

I have come up with a jQuery solution but have ran into a few problems.
I have applied this to Numerical and Alphabetical sizing and have the same problem.

$(".Value li:contains('XL')").insertBefore($(".Value li:contains('XXL')"));
$(".Value li:contains('L')").insertBefore($(".Value li:contains('XL')"));
$(".Value li:contains('M')").insertBefore($(".Value li:contains('L')"));
$(".Value li:contains('S')").insertBefore($(".Value li:contains('M')"));
$(".Value li:contains('XS')").insertBefore($(".Value li:contains('S')"));

This works fine until you get to a single character value which has a sister value. In other words that code will rearrange L M S into S M L just fine, but it runs into problems if there is a XS or XL, or in the case of numerical sizes getting down to a single digit. Such as a size 7 if there are 7 1/4, 7 1/8 etc.
This is obviously because of the .contains() function.

I have tried using .filter() but I can’t get it to select the elements I want let alone .insertBefore

Thanks.


Edit with HTML as requested:

<div class="Value">
    <ul>
            <li>
    <label><input name="variation[1]" type="radio" class="RadioButton" value="5429"  /> XL</label>
</li>   <li>
    <label><input name="variation[1]" type="radio" class="RadioButton" value="5430"  /> 2XL</label>
</li>   <li>
    <label><input name="variation[1]" type="radio" class="RadioButton" value="5431"  /> M</label>
</li>   <li>
    <label><input name="variation[1]" type="radio" class="RadioButton" value="5432"  /> L</label>
</li>   <li>
    <label><input name="variation[1]" type="radio" class="RadioButton" value="5433"  /> S</label>
</li>
    </ul>
</div>

Edit 2

As can be seen from the above HTML and what I’ve just realised – it’s not displaying in Alphabetical / Chronological order of the labels (size), but rather chronologically for the radio buttons value. As mentioned this is generated dynamically by the shopping cart when importing products from our POS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:10:23+00:00Added an answer on June 2, 2026 at 2:10 pm

    I’m not sure how general purpose a function you need, but this code will sort the HTML you posted and can be passed other selectors and other key orders:

    function sortLabels(ulSelector, order) {
        var parent = $(ulSelector);
        var items = $("li", parent).each(function() {
            // get text out of the label and trim
            var txt = $.trim($(this).find("label").text());
            // get order number
            var num = order[txt] || 0;
            // save this on the DOM object for easier sorting
            this.sortKey = num;
        }).get().sort(function(a, b) {
            // sort DOM array
            return(a.sortKey - b.sortKey);
        });
    
        // reinsert DOM elements in order
        for (var i = 0; i < items.length; i++) {
            parent.append(items[i]);
        }
    }
    
    var sizeOrdinals = {
        "XS": 1, "S": 2, "M": 3, "L": 4, 
        "XL": 5, "XXL": 6, "2XL": 7
    };
    sortLabels(".Value ul", sizeOrdinals);
    

    Working demo: http://jsfiddle.net/jfriend00/B45tJ/

    By simply defining a new table of ordinals, you can use this to sort other types of values like shoe sizes without rewriting the sortLabels function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After upgrade from Silverlight 4 to Silverlight 5 I get System.Exception 6028 when MediaElement
I have my paid app in appstore now I am converting it to a
After a user purchases an app from the app store, and runs it, is
After repeated searching I have not found an elegant solution to this issue: how
After a small amount of research it seems that TCP MD5 Signatures are enabled
after I run node-waf configure and node-waf build , a .lock-wscript show in my
After a lot of fight I figured out in a declaration like int A[2][3],
After I've asked for a method to combine 2 arrays I got several answers
After a MySQL select statement, I am left with the following: set([('1@a.com',), ('2@b.net',), ('3@c.com',),
After I have opened a file include()ed with gf , how can I copy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.