Skip Navigation

[Résolu] Parametric search only works in default language

This support ticket is created Il y a 7 années et 3 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 13 réponses, has 3 voix.

Last updated by Beda Il y a 6 années et 9 mois.

Assigned support staff: Beda.

Auteur
Publications
#322089

I first raised this issue on the WPML support forum and they have suggested that I need to raise it here.

I have built a parametric search using Types/Views and used WPML to translate the strings within the View/templates etc.

Visually, it looks ok in both languages. All translations are present.

But - the parametric functionality does not work on the second language (Welsh). Nothing updates and changes when you choose different options, as it does on the English version.

URL of (my) website where problem appears:
English version: hidden link
Welsh version: hidden link

An easy way to test this is to use the tick box to filter on the "free events only" option.
The event called "come and build a wildlife den" is not free, and it disappears from the English view when the box is ticked. But nothing happens on the Welsh version (the event is called "Dewch i adeiladu den bywyd gwyllt" in Welsh. The Welsh version of the record (custom post) has the same data.

Vincenzo on the WPML support said that he detected the following error:

XMLHttpRequest cannot load <em><u>hidden link</u></em>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<em><u>hidden link</u></em>' is therefore not allowed access.

I'd appreciate some guidance to help me get the Welsh version running properly.
Many thanks
Alan

#322111

Can you share access details to take a look at your setup?

Thanks
Caridad

#324431

It seems to be a problem with Ajax requests and different domains per language.

To get it working straight away, you can disable ajax in this view and it should work fine.

Another solution is to add this line to functions.php in your theme:

Header("Access-Control-Allow-Origin: *");

Let me know how it goes.
Regards
Caridad

#324563

Hi Caridad

I have added that line to my functions.php file.
The form on the Welsh page now does seem to respond to the filtering, BUT - the results then revert to English instead of staying within the Welsh.

For example:
hidden link

If you then select an option, it filters the content but everything inside the View changes back to English.

How do we make it so that the content within the View stays with the Welsh language versions?

Thanks
Alan

#325125

Since Caridad currently has a few days off, I will replace him here in the forum.
I hope this is OK for you.

I can see that the Search results work fine (in the secondary language) if the Search view is set to reload the entire page once Search Button is hit.

If you update with AJAX, the English (original) content is loaded instead.

I would need to know:

1. Does it work with different directory or even better, with language name added as parameter ?
Dashboard > WPML > Languages > Language URL Settings

2. I am also trying to replicate this one locally now. If I can replicate it I will need to escalate it, as it would be a BUG in either Views or WPML. Could I provide the site you gave me access to for Tests to our DEV, or would you prefer us to work on a test site (perhaps you have one) or with a site's snapshot?

Testing can include as well disabling Plugins, changing setups etc.

A backup would be necessary if you give us permissions to test on your Site there directly.

Please could you provide me the additional Infos?

And also expect my informations here in the forum, regarding my tests.

Thank you for your patience.

#325131

OK; I already replicated the setup and can not reproduce that issue.

I use also AJAX Updates of my Parametric Search results.

Where are the differences from my test setup to your site?

1. It's a clean, fresh WordPress install
2. I translated a Custom Post Type made with Types Plugin
3. I only use a minimal (WPML + Toolset) setup of plugins
4. Those are all latest stable version, fresh installed
5. I use a default WordPress Theme and a custom Debug Theme I use in such situations, both give good results.

I deduce from this, that the issue must rely in a specific setup on your site.

Does the issue also persist with Theme Twenty Fourteen and NO Plugins BUT WPML + AddOns + Toolset?

If not, could you then re-enable the Plugins one after the other, and check the issue each time you enable a plugin?
Please report me when the issue comes back
It might also be due to the Theme.
Please do reactivate your Theme only after you are sure the issue isn't coming form a 3rd Party Plugin.

Can you try to reproduce this issue on a minimal (best case, fresh WordPress) install?

I also see now that your Views and Types plugins are not updated. Could you do that?

Please don't hesitate to inform me in case the issue persists

Thank you for your patience.

#329393

I've had an email from the cleanup robot.
I've been on leave for two weeks and will continue to look at this issue when I return to work.
Many thanks for your help so far.
Alan

#329472

Thanks for the Details

Please don't hesitate to inform me in case the issue persists and let me know if you have further questions regarding the issue mentioned in this Thread

Please also do not hesitate to open a new thread if other issues or problems arise

Thank you for your patience.

#330344

Hello

I have created a brand new clean install with just the Toolset and WPML plugins installed, on Twenty Fourteen as suggested.
I've used the module manager to export/import my templates/views/cpt's

I'm still seeing the same issue (Ajax not working) when the language is set to use different domains.
The Ajax refresh does work when I switch the language URL to use language name as parameter.

But, I need it to work with different domains per language, as I feel this gives equal respect to users of both languages, without one being seen as an after-thought or add-on (it's quite a political thing here in Wales!)

If I switch the VIEW to not use Ajax, it does refresh the page in both languages, but only after I added this line to functions.php

Header("Access-Control-Allow-Origin: *");

Just to check if I've done this part correctly:-
To create the domain for my other language, I simply created a domain alias in the CPanel of my web host. So the site "test.conwydisabilitynetwork.info" (where the WP installation is) has a domain alias of test.rhwydwaithanableddconwy.info, and it's the latter URL which I fed into WPML as the domain to use for the Welsh content.
This works fine on ordinary posts and pages, so I'm guessing I didn't do anything wrong??

I'm happy to share login details to this test site if that helps to determine if there is a bug.
thanks

#330408

Thanks for the Details

Currently I don't see anymore results on the original problematic Pages (No results found)

Theoretically you should register domains (for use in languages) as Domains with a Domain name Registrar.

I would need to request temporary access (WP-Admin and FTP) to your site
- preferably to a test site where the problem has been replicated if possible -
in order to be of better help and check if some configurations might need to be changed

Your next answer will be private which means only you and I have access to it.

❌ Please backup your database and website ❌

✙ I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site.
This is also a reason the backup is really important

✙ Please add the Links to the Views Edit Screen, the Page/Post where you insert the View and the corresponding Front End Page/Screen

Please could you provide me the additional Infos, and as well permit me to perform the required steps?

Thank you for your patience.

#330887

Thanks Beda,

I've sent login details for the new test site.

Yes you have permission to deactivate plugins and themes and change configs etc - whatever you like. It's a purely test site just to get this issue resolved.

I've added a link in the Menu to the Events page. This is a page called Events, in which the View is embedded. I've added two events in the system, and one of them is marked as "FREE" so that's a quick way to test the functionality.

There is only one View in the system, which is the parametric search, and it's set to "AJAX results update when visitors change any filter values".

The domain issue - on the live site, I do have the domain registered for both languages, but I was instructed to create the 2nd language domain as a domain alias for the default domain.
For this test site, I just created an alias. It still works fine for ordinary posts and pages.

The WPML > Language URL options are set to "A different domain per language" which is how I would like it to work. As I mentioned earlier, if we switch it to "Language name added as a parameter", the Ajax function in the search does work, but I can't use the parameter option on my live site.

I haven't implemented all of the translated strings (disappointed there isn't an option in the Module Manager to include those?)

Thanks so much for your help.
Alan

#331212

Thanks for the Details

I added Header("Access-Control-Allow-Origin: *"); to the functions.php because the Search Button was actually not working in the Translated version (console error)

I went to:
hidden link
checked "Only show FREE events?" and hit "search"
The View updates by AJAX and shows me "Christmas 2015"

Then I went to:
hidden link
Checked "Dangos digwyddiadau am ddim yn unig?" and hit "chwilio"
The View updates by AJAX and shows me "Christmas 2015"

Instead it should display "Nadolig 2015"

I have reported this issue and the 2nd Tier will get back at you ASAP.

I have it replicated as well with a simple Post View, on your test site there.

I can as well confirm it only happens with Different Domain per language, that's why I could not replicate it Locally.

This is a WPML issue, but I do not want to send you back to the WPML Support since you already came form there to us.

Please expect our informations here in the forum.

Thank you for your patience.

#332564

I apologize the delay here

Our Lead DEV of Views Plugin has found a workaround, which unfortunately can not be used as a generic solution but was handcrafted for this specific site only.

I can therefore not provide yet a ready to go solution for this issue.

The Issue needs changes in 2 Plugins: Views and WPML itself.

Our DEV teams are informed and working hard to ensure a fix ASAP.

Unfortunately, when exactly our developers will release a Update including the required Fix is not up-to us Supporters to determine.

Each issue reported in, whether a bug or a new feature request, is taken seriously into consideration.

It is given a high or low priority based on a number of factors.
Factors which those with the overview of all things related are in the best position to determine.

I apologize any inconvenience this may cause.

I want to emphasize again on the point, that the solution (workaround) found by our Views Lead DEV can NOT be implemented on other sites.
In includes hardcoded elements which usually (and for properly working) must be variable, therefore we can currently not provide a generic solution.

I really apologize this issue, and can assure that our DEV teams are working hard to provide a solution ASAP.

Please do not hesitate to open a new thread if other issues or problems arise

Thank you for your patience.

#368035

This is resolved in the current Stable Toolset and WPML versions.

Please ensure fully updated versions and if any issues surge, please don't hesitate to open a new ticket in regard.

Thank you