VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: vmfyelloq19 on May 26, 2020, 08:51:31 AM

Title: Cannot sort countries?
Post by: vmfyelloq19 on May 26, 2020, 08:51:31 AM
Hi folks,

I cannot sort countries in VM backend, neither by sorting by drag/drop nor by entering sort order number manually.
As soon as I click on the up/down arrows button in the columns header, order get's messed up.
(.../index.php?option=com_virtuemart&view=country)
Javascript console says:
window.saveorder() is deprecated without a replacement! M226 core.js:1
window.checkAll_button() is deprecated without a replacement! M226 core.js:1

I'm very probably not the first to have a need to sort countries, so I'm sure I', missing something very simple here. Any hints?

TIA!
Title: Re: Cannot sort countries?
Post by: jenkinhill on May 26, 2020, 11:29:57 AM
VM version?
Title: Re: Cannot sort countries?
Post by: vmfyelloq19 on May 26, 2020, 14:19:09 PM
Latest stable (3.6.10 10211)
Title: Re: Cannot sort countries?
Post by: GJC Web Design on May 26, 2020, 14:26:47 PM
Yes.. on 3.8.0 10311 it seems completely broken -- by drag and drop or manual ordering
Title: Re: Cannot sort countries?
Post by: vmfyelloq19 on May 26, 2020, 18:53:13 PM
Thank you GJC Web Design.

So there's no way to sort countries right now?
I cannot launch the shop with messed up country ordering...
I really wouldn't like to do that via SQL, esp- if the shopowner eventually *will* use the countries admin page and mess it up again.
Title: Re: Cannot sort countries?
Post by: GJC Web Design on May 27, 2020, 00:01:55 AM
Till fixed the only way is to manually enter the order in the ordering column in #__virtuemart_countries

In English they display alphabetically but I know this is not correct if the the country names are changed to other languages
Title: Re: Cannot sort countries?
Post by: vmfyelloq19 on May 27, 2020, 11:44:08 AM
Hello GJC Web Design,

thank you for your response. That is bad news!
Is this a confirmed bug on the VM buglist and is there any time frame when it might be fixed?

And since we are at it:
I would like to suggest to allow ordering per language.

Thanks
Title: Re: Cannot sort countries?
Post by: Milbo on May 27, 2020, 12:03:34 PM
Quote from: GJC Web Design on May 27, 2020, 00:01:55 AM
Till fixed the only way is to manually enter the order in the ordering column in #__virtuemart_countries

In English they display alphabetically but I know this is not correct if the the country names are changed to other languages

No, that was completly sorted. You can order it by using the ordering values, any with 0 are sorted alphabetically after teh language. Even "Östereich" is in german set at the correct place (the value from the db is "austria")
Title: Re: Cannot sort countries?
Post by: Milbo on May 27, 2020, 12:10:36 PM
Quote from: vmfyelloq19 on May 26, 2020, 14:19:09 PM
Latest stable (3.6.10 10211)
Quote from: GJC Web Design on May 26, 2020, 14:26:47 PM
Yes.. on 3.8.0 10311 it seems completely broken -- by drag and drop or manual ordering

You noticed, that you talk about different versions? I am actually surprised that there is any dragndrop. Dragndrop should only appear, when you see all countries. Then it works normally.

It is very rare that people want to sort all countries manually. The countries are already alphabetically sorted. But it makes sense to prefer 1-3 countries and put them on top. More sorting makes no sense.
Title: Re: Cannot sort countries?
Post by: vmfyelloq19 on May 27, 2020, 13:02:47 PM
Hello Milbo,

that's exactly what we tried to acomplish: sort a handful of common country to top, leave the rest to auto-sort by name.

As initially posted: drag and drop ordering is not working, neither is entering the order-ids manually and clicking on the up-down-arrow "save order" button. Ordering get's messed up any time.

Apart from the UI not working, maybe you could explain the ordering algorithm?
I was on the impression that I cannot have duplcate order ids (as the JS was re-numbering the order-ids iirc)

Certainly it would be perfect to have:
a) Main country - ordering 1 (keep this on top)
b) A handful of important countries - ordering 2 (sort these alphabetically by current language)
c) All other countries - ordering 3 (sort these alphabetically by current language, but after all countries with ordering 1 and 2)

If that's the way the ordering is working I'd be more than fine with that!

TIA!

(Using latest stable 3.8.2 10325 - sorry, got that wrong initially)
Title: Re: Cannot sort countries?
Post by: jjk on May 27, 2020, 20:41:13 PM
Quote from: vmfyelloq19 on May 27, 2020, 13:02:47 PM
Certainly it would be perfect to have:

That should be pretty easy to achieve.
By default the country list ordering values are all set to '0'. You can enter for example -3 into the ordering field of your preferred (top) country and for example -2 and -1 for two countries that you want to be displayed right below. Then click the 'Save' ordering button (The small button between Ordering and Published). That does work in my case.
Title: Re: Cannot sort countries?
Post by: vmfyelloq19 on May 28, 2020, 09:46:00 AM
Hello jjk,

maybe did not explain this properly.
Your tip wouldn't work for multi-language sites, consider:

-4 Italy (shop's home counttry on top, fine)
Then:
-3 France (it:Francia)
-2 Sweden (it: Svezia)
-1 United Kingdom (it: Regno Unito)
0 all other countries (make them sorted alphabetically)

Ordering would be wrong for italian, as Regno Unito need to be before Svezia here.
What I tried to say was:
-2 Italy
-1 France (it:Francia)
-1 Sweden (it: Svezia)
-1 United Kingdom (it: Regno Unito)
0 all other countries
where all -1 countries get sorted automatically, as well as all 0 countries.
Something like "order by ordering asc, translated_country_name asc"





Title: Re: Cannot sort countries?
Post by: jjk on May 28, 2020, 11:33:00 AM
I've used what I wrote on my previous reply for my own multilingual shop. VM keeps the ordering in all languages, in your case --4, -3, -2, -1 and the rest in alphabetical order.
So in Italian the language drop-down would show:
(-4) Italia
(-3) Francia
(-2) Svezia
(-1) Regno Unito
followed by the rest in alphabetical order.
Title: Re: Cannot sort countries?
Post by: vmfyelloq19 on May 28, 2020, 13:02:44 PM
Hi jjk,

yes. as I wrote, that's the wrong order for italian. It needs to be
Italia
Francia
Regno Unito
Svezia
(other)

while in english it needs to be
Italy
France
Sweden
United Kingdom
(other)