Skip Navigation

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.

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by Nicolas V. 1 year, 8 months ago.

Assisted by: Nicolas V..

Author Posts
September 27, 2023 at 11:36 am #14473471

xavierC-7

So, I have a custom taxonomy of woocommerce products : "marque".
Main language is french, secondary language is english.
I have a custom template for this taxonomy : taxonomy-marque.php
I have an ACF galery field for this taxonomy : "m-visuels"
Field "m-visuels" is set to "copy" in wpml settings.
Field group for this taxonomy is set to "Same fields across languages".
Advanced Custom Fields Multilingual is installed and latest version.
Here is my code :
$marque = get_queried_object();
$galerie = get_field('m-visuels', $marque);

In french, $galerie returns an array of the image object(s). (and this is what I want ultimately)
In english, it only returns the ID of the image object(s).

What did I do wrong ?

Capture d’écran 2023-09-27 133304.jpg
Capture d’écran 2023-09-27 133246.jpg
September 28, 2023 at 12:14 pm #14481535

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello,

Welcome to the WPML support forum.
- Go to "ACF > Field Groups" and edit that group
- Can you tell me what is the Translation preference for that gallery field? It should be "Copy".
- What is the "Return Format"? Image Array, Image URL or Image ID?

Also can you share the code you use in your PHP template to display that field?

PS: I had a similar case yesterday, where the client changed the translation preference to "copy" and the return format to "image URL" after the taxonomy got translated. In that case he had to resave all translations (term by term) in order to apply the new settings to the translated terms and make it work.

September 28, 2023 at 12:27 pm #14481579

xavierC-7

Field group is set to "Same fields across languages"
Translation preference for the gallery field is "copy"
Return format is "image array"

Capture d’écran 2023-09-28 142252.jpg
Capture d’écran 2023-09-28 142050.jpg
Capture d’écran 2023-09-28 142028.jpg
September 28, 2023 at 3:55 pm #14483497

xavierC-7

Sorry, I was on the phone when I answerd your message and I realize I forgot to say Hi, thanks for taking this matter into your hands.

September 29, 2023 at 12:13 am #14485121

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hey,

At this stage I'd like to request an admin access in order to have a closer look.

I've done some research and found a similar case where get_field() with image fields from taxonomy terms returns a string instead of the expected value.

I want first to have a look to discard any other possibility. And if it's the same issue, I'll report to our compatibility team.

I activated a private field for your next answer where you can provide access safely - ideally to a staging copy of your site. Don't share your own admin account, create a new one that you will delete when we finish troubleshooting.

IMPORTANT: Before we proceed, please backup your site and database.

September 29, 2023 at 9:44 pm #14490161

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hey,

Thank you for the staging site. I have escalated all the information to our second tier support. I'll get back to you as soon as I have their feedback.

Thanks for your patience,
Nico

September 30, 2023 at 12:45 pm #14491413

xavierC-7

Thanks, there is an easy fix in case the tier2 support can't find the reason :
if(ICL_LANGUAGE_CODE == 'en') {
//and here extrapolate the images data/url from their IDs.
}
But if they find the reason, it would be best and it would probably help other people too with the same issue, and prevent breaking in case a WPML update or whatever...

October 2, 2023 at 2:49 pm #14498933

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Bonjour,

Je suis toujours en attente d'une solution. Par contre j'ai trouvé un solution d'appoint de mon côté.

Si vous re-sauvegarder la traduction dans le backoffice ("Produits > Marques > Anglais"), le problème est résolu.

Prenez par exemple: hidden link

J'ai simplement cliqué sur "Mettre à jour" et l'Array apparait bien sur le frontend maintenant.

Je comprends que vous avez de nombreuses marques et ce n'est pas idéal, c'est pourquoi j'attends de voir si le deuxième niveau à une meilleure solution.

October 2, 2023 at 3:24 pm #14499135

xavierC-7

Il reste un mystère : comment n'y ai-je pas pensé ?!
Je crois que j'ai tout testé, sauf le plus évident.
J'ai utilisé l'interface WPML -> traduction de taxonomie pour générer les traductions, ça doit être des "effets secondaires" de cette interface sur les champs ACF "gallery".
Pas de problèmes, je vais ouvrir et enregistrer 200+ marques, ça va me prendre 10 minutes, mais ça me semble tout de même une bonne idée de remonter l'info au staff pour de futures MAJ. Je laisse le "staging" ouvert pour le moment ?
Merci Nicolas !

October 3, 2023 at 11:35 am #14503997

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Re,

Une autre solution que vous pouvez essayer c'est de créer un produit test (vide) et d'y ajouter toutes les marques. Puis de traduire ce produit pour voir si toutes les marques sont mises à jour.
Ref: https://wpml.org/faq/how-to-translate-all-taxonomy-terms-at-once/

Serait-il possible de prendre une copie Duplicator de ce site staging pour que l'équipe de compatibilité puisse travailler sur ce problème en local?

Une fois le problème résolu, j'éliminerai cette copie. Dites moi si vous êtes d'accord.
https://wpml.org/fr/faq/provide-supporters-copy-site/

October 3, 2023 at 4:01 pm #14507141

xavierC-7

Merci Nicolas,

Mais le site est à deux doigts du lancement, et deux nouveaux projets poussent de l'autre côté, je ne vais pas avoir le temps.

Merci pour votre aide !
Au plaisir de vous retrouver sur l'assistance WPML