Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getAllEnabledStatesAsListGroupedByCountryId returns states in random order #1512

Closed
brianjhanson opened this issue Jun 16, 2020 · 2 comments
Closed
Labels

Comments

@brianjhanson
Copy link

Description
I'm not sure if this is really a bug, but the getAllEnabledStatesAsListGroupedByCountryId seems to return states in a random order on every refresh.

To Reproduce
Output `{% dd craft.commerce.states.getAllEnabledStatesAsListGroupedByCountryId %} and refresh. On each refresh the order seems to change.

Video of the output

Expected behavior
I expected them to be ordered alphabetically.

Additional info

  • Craft version: 3.4.18
  • PHP version: 7.3.16
  • Database driver & version: MySQL 5.7.29
  • Plugins & versions:
Asset Rev 6.0.2
Cookies 1.1.12
Craft Commerce 3.1.3
Feed Me 4.2.2
Freeform 3.6.7
Gift Voucher 2.3.0
Klaviyo Connect 3.1.3.2
one-campaign-monitor dev-feature/craft-3
One Imgix dev-craft-3
PayPal Checkout for Craft Commerce 1.1.0
PayPal for Craft Commerce 2.1.0.1
Rackspace Cloud Files dev-feature/parse-env-vars
Redactor 2.6.1
SEOmatic 3.3.2
ShipStation Connect 1.3.2
Stripe for Craft Commerce 2.3.0
@lukeholder
Copy link
Member

Thanks for reporting that! I’ve just fixed it for the next release.

You can work around the bug without waiting for the release by just sorting one country in the country list manually within the CP, and same for each group of states inside each country.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#fb4cba2f85a36d4a25c3fdd760256d66d8f4bb0a as 3.1.8",
  "...": "..."
}

Then run composer update.

Thanks.

@brianjhanson
Copy link
Author

Thanks @lukeholder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants