Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Laurence Gillian 600 posts 1219 karma points
    Jan 16, 2014 @ 16:33
    Laurence Gillian
    0

    Sorting Countries

    Hello,

    I'm quite new to TeaCommerce, but I'm having difficulties sorting the Countries. When I try and sort by name, the list just becomes incredibly unsorted! I can't quite work out what it's sorting it by, but it's not quite right!

    This screen grab explains all :-)

    http://screencast.com/t/pk8rQGaCW2qO

    Maybe the issue is actually with Umbraco (6.1.3) as it seems to sort like:

    1
    10
    101
    2
    20
    201

    etc

  • Anders Burla 2560 posts 8256 karma points
    Jan 17, 2014 @ 15:01
    Anders Burla
    0

    Hmm we use the sort code from Umbraco - but has copied it to TC - so if there was a bug in Umbraco that might be the case. Could you try and upgrade to latest Umbraco. Then if it still fails, we would have to look into it :)

    Kind regards
    Anders

  • Laurence Gillian 600 posts 1219 karma points
    Jan 22, 2014 @ 12:22
    Laurence Gillian
    0

    Hey Anders, hope you are well.

    I have upgraded to v6.1.6 (and cleared my cache), but I am still experiencing this sorting issue.

    http://screencast.com/t/VmFpvwPY

    Best wishes, Laurence :-)

  • Anders Burla 2560 posts 8256 karma points
    Jan 22, 2014 @ 15:31
    Anders Burla
    100

    Hi Laurence

    You are right that there was a problem in older versions of Umbraco with sorting. Because we support 4.7 of Umbraco we need to leave this bug as it is. BUT of course when we finish the version for Umbraco 7 - we can fix it and dont support 4.7 and back.

    If you can write a small sql script to update and then recycle your website (the cache is killed) - then your sorting will be good. But yeah - the UI cant sort correctly.

    Kind regards
    Anders

  • Laurence Gillian 600 posts 1219 karma points
    Jan 28, 2014 @ 18:05
    Laurence Gillian
    0

    Hi Anders, would you have to hand the code required to sort the table? It's making my mind hurt a little today! Thanks, Laurence

  • Anders Burla 2560 posts 8256 karma points
    Jan 29, 2014 @ 09:17
    Anders Burla
    0

    I dont have the sql - so I would have to write it and that would take some time for me that I dont have the next couple of days :)

    You will be writing a cursor that loops your data and then updates the sort number.

    You can also loop them in code using PetaPoco (Use the DatabaseFactory to get a database instance using Autofac). Then use C# to update.

    Kind regards
    Anders

  • Laurence Gillian 600 posts 1219 karma points
    Feb 17, 2014 @ 13:21
    Laurence Gillian
    1

    Credit goes to John C Scott, Thanks! x

    DECLARE @OrderSource TABLE(
        newOrder int,
        Id    int
    )
    
    INSERT INTO @OrderSource
    SELECT ROW_NUMBER() OVER (ORDER BY Name) as newOrder,
    [Id]
    FROM [TeaCommerce_Region]
    WHERE IsDeleted=0 and StoreId=1
    
    UPDATE [TeaCommerce_Region]
     SET [Sort] = o.newOrder
    FROM @OrderSource o 
    join [TeaCommerce_Region] t on t.Id  = o.Id
    
Please Sign in or register to post replies

Write your reply to:

Draft