This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem:
I have enable a Product Categories - Grid Settings on my home page. I have set the section as I prefered and then I have enable WPML. This changed the ordering of my categories from default (as I selected them) to alphabetical ordering.

Solution:
It seems that get_terms does not respect order of passed elements in the include directive when using WPML. For now, a temporary fix is to go to the wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering folder and open the class-wpml-term-query-filter.php file. Once you did this, just simply change this code from line 175:

"SELECT taxonomy, term_id FROM {$this->wpdb->term_taxonomy}
             WHERE term_id IN (" . wpml_prepare_in( $ids, '%d' ) . ")"

to

"SELECT taxonomy, term_id FROM {$this->wpdb->term_taxonomy}
WHERE term_id IN (" . wpml_prepare_in( $ids, '%d' ) . ")
ORDER BY FIELD(term_id, (" . wpml_prepare_in( $ids, '%d' ) . "))"

This topic contains 49 replies, has 2 voices.

Last updated by Radu 4 weeks, 1 day ago.

Assigned support staff: Radu.

Author Posts
June 27, 2019 at 8:18 am #4097761

dimitriosM-2

Good day,

I have enable a Product Categories - Grid Settings on my home page. I have set the section as I prefered and then I have enable WPML. This changed the ordering of my categories from default (as I selected them) to alphabetical ordering.

How am I supposed to change that as I have selected it?
hidden link

Thank you

June 28, 2019 at 7:38 am #4105157

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

I just tried to access the link that you attached but the page is not loading. Can you check it out and tell me if I should access a different link so I can see this ordering issue, please?

Thanks,
Radu

June 28, 2019 at 10:53 am #4106697

dimitriosM-2

This is the url of the site. I don't know if there is anything with your IP.

July 1, 2019 at 8:59 am #4116731

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

Do you have any IP restriction on your server? My IP is 5.30.214.220, in case you need to add it to a whitelist so I can access the link. I tried to open the website using different browsers but I had no luck with that.

Thanks,
Radu

July 1, 2019 at 9:48 am #4117425

dimitriosM-2

Good day and nice month,

I have added you on my white list! Can you please try again to visit the link of the site? Do you need any credentials for accessing the administration area? If yes, how should I send them?

Thanks in advance.

July 1, 2019 at 1:30 pm #4119391

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

I was able to see the website this time. Now, can you give me access to the dashboard area and have a look at the product categories settings, please? The next reply is set to be private so you can safely send me the credentials.

Thanks,
Radu

July 2, 2019 at 11:35 am #4126387

dimitriosM-2

Good evening Radu!
Did you had time to check my site with the issue of ordering?
Thank you.

July 2, 2019 at 12:30 pm #4126725

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

I was checking your website right when you send me the most recent message 🙂

As I could see, you're using a WPBakery block called WooCommerce Products in order to adde this section for product categories. Can you tell me if this is the part that we are taking about, please? (see the attached screenshots). I want to make sure that I'm checking the right element.

Thanks,
Radu

July 2, 2019 at 12:44 pm #4127037

dimitriosM-2

Well actually, I have been mistaken and send another site credentials. If you be kind to create another private message to pass you the correct credentials.
Forgive me for the mistake

July 2, 2019 at 2:25 pm #4127899

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

No worries. I set the next reply to be private so you can send me again the right credentials.

Thanks,
Radu

July 3, 2019 at 12:43 pm #4136485

dimitriosM-2

Radu, anything yet? Is there anything I can do?

July 3, 2019 at 1:41 pm #4137043

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

Thank you for sending me the credentials for the website!

I had a look at the product category block that you're using. From what I see, this is a block added to the theme in version 2.8 (hidden link) but the latest version that was last tested with WPML is 2.4.9 (https://wpml.org/theme/shopkeeper/). In this case, I would need to make a few tests and see if this new element is compatible with WPML.
Can you send me a copy of the latest version of the theme so I can create a clean website install, add the theme, and have a closer look at this Product Categories Grid element? If I find that there's a compatibility issue with this new element, I'll pass this to the development team, and they will work with the theme authors to make everything go back to normal.

Thanks,
Radu

July 4, 2019 at 6:42 am #4140499

dimitriosM-2

Good day,
I will send you the copy. Plese send me your email. How long it will take to solve this issue?
Thank you.

July 4, 2019 at 7:51 am #4140871

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Dimitrios,

It's hard to say how long will it take to get this fixed. I am trying to take care of each ticket as soon as possible. First I need to check this out by trying to replicate the issue on a clean install (that's why I need the copy of the theme) and then report it to my colleagues that will check it a bit closer.
You can upload the theme to your Google Drive account (or Dropbox) and send me here the link. The next reply is private so the theme will be accessible only to you and me.

Thanks,
Radu

July 4, 2019 at 10:00 am #4142161

dimitriosM-2

The reply was not private. Please make the next reply private so I can re send you the url of the theme