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 1 month, 3 weeks ago.

Assigned support staff: Radu.

Author Posts
July 4, 2019 at 11:42 am #4142883

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

The previous reply where you added the Google Drive link is now private. Can you restore the files so I can see them, please?

Thanks,
Radu

July 4, 2019 at 2:27 pm #4144425

dimitriosM-2

I have remove the folder so the link will be dead. Please make the next one private so I will resend the link

July 5, 2019 at 7:56 am #4148717

dimitriosM-2

Please make the following ticket private so I can send you the link with the theme.

July 5, 2019 at 8:06 am #4148923

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

Can you attach the link once again, please? I set the next reply to be private.

Thanks,
Radu

July 10, 2019 at 7:37 am #4176651

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

I just used the same block on a clean installation and the order of the categories is kept (please see the attached screenshots).
Also, I checked the English version of the homepage and I could see that the categories here are not alphabetically ordered, only the first two categories have switched places.
Can you create a new page, with just this block on it to see if this is still happening, please? If the issue is still there, please give me a link to it so I can have another look.

Thanks,
Radu

July 16, 2019 at 10:21 am #4218949

dimitriosM-2

Hello,
It is still the same. It is ordering the categories alphabetical. I have set the categories random and I reorder them again and again but the manually ordering is not working.
hidden link
Maybe you haven't translate your categories on another language. I am using Greek if that matters.

July 19, 2019 at 7:14 am #4244401

dimitriosM-2

Good day,
Have you seen the issue of the catefories ordering?
Thank you.

July 21, 2019 at 8:53 am #4251793

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

Yes, I've seen the issue on your website. However, in order to investigate this issue a bit closer, I need to be able to replicate it on a clean install and pass it to the compatibility team. Since I wasn't able to replicate this (as I mentioned on a previous message), I created a new website and I was hoping that you can log into it (using the credentials I attached to the previous message), configure WPML like on your website, add the theme, and create again that category element. If the issue appears here, I'll pass this website to my colleagues and they will check things out.

Thanks,
Radu

July 24, 2019 at 6:32 am #4270555

dimitriosM-2

Good day,
I can't install Bakery plugin with the following error.

1. An error occurred while installing Salient WPBakery Page Builder: Destination folder already exists. /var/www/public/intuitive-donkey/wp-content/plugins/js_composer_salient/.
2. An error occurred while installing Salient Portfolio: Destination folder already exists. /var/www/public/intuitive-donkey/wp-content/plugins/salient-portfolio/.

Please remove it so I can install it on the demo site you gave me to replicate the issue.

Thank you

July 24, 2019 at 7:02 am #4270831

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

I installed and activated the required plugin. You can now go on and replicate the issue 🙂

Thanks,
Radu

July 24, 2019 at 9:31 am #4272445

dimitriosM-2

Hello,

here you go. On the site you've send me, I have create a page home-en. I have set the ordering of product manually and as first category I have set Olives & Olive oils. Althought the ordering in front page is not as I have set it manually.

Thank you.

July 26, 2019 at 8:37 am #4288379

dimitriosM-2

Good day,
Did you had time to check it?
Thank you

July 29, 2019 at 7:22 am #4297317

Radu
Supporter

Languages: English (English )

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

Hey Dimitrios,

I was able to check the elements you added to the website I send to you. Thank you for taking care of that!
Can you tell me if you did anything else, other than configuring the WPML plugin, install the theme (and the required plugins), create the product categories in English, translate them in Greek, then add the category block to a new page? I tried again to replicate the issue by following the steps I presented (and by using English and French) but the order was still intact. Now, my last guess is that this is happening when using the Greek language as secondary language but I first wanted to make sure that I'm following the same steps as you did and that's why I'm asking you this. After this, I'll pass this to the development team and they'll check things out a bit closer to see what can be done to make things to back to normal.

Thanks,
Radu

July 30, 2019 at 7:13 am #4305139

dimitriosM-2

Good day Radu,

I install the theme and the plugins. Install WPML, create the categories, translate them and then I create the Home page with category widget. I have done nothing else. The order is changed in every case (with Greek secondary language or main). If I remove WPML, the order is taken by the widget as I have set the ordeing.

Thank you for you time!

August 1, 2019 at 6:06 am #4318959

dimitriosM-2

Hello Radu,

Do you have any info for me? Did you check the installation I have create on your server for the issue?

Thank you and have a great day!