Navigation überspringen

Dieses Thema ist gelöst. Hier finden Sie eine Beschreibung des Problems und der Lösung.

Problem:
When selecting a translated gift card template in a secondary language for a product, the template reverts to the one chosen in the primary language after saving the product changes.

Solution:
1. Add the following code to your theme's functions.php file to make the numbers appear in the Advanced Translation Editor:

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

2. Navigate to "WPML > Settings > Custom Field Translation". Set the "_pwgc_show_email_preview" custom field to 'Don't translate' and "_pwgc_email_design_ids" to 'Translate'. Remember to click on the "Show System Fields" link to find these fields.

3. Make a minor change to the default product and save it. Then, retranslate the product. In the Translation Editor, you will see the template ID for the default product. Enter the template ID you want for the translated product in the translation of the ID value.

4. Open the file .../wp-content/plugins/pw-gift-cards/includes/class-wc-product-pw-gift-card.php and locate line 172. Replace:

$original_product_id = icl_object_id( $this->get_id(), 'product', TRUE, $default_language );

with:

$original_product_id = apply_filters( 'wpml_object_id', $this->get_id(), 'product');

We have tested this solution in our sandbox environment, and it worked correctly. Our compatibility team will contact the plugin author for further steps.

If this solution does not apply to your situation, or if it seems outdated, we recommend checking the related known issues, verifying the version of the permanent fix, and ensuring you have the latest versions of themes and plugins installed. If you still encounter issues, please open a new support ticket with us.

Dies ist das technische Support-Forum für WPML – das mehrsprachige WordPress-Plugin.

Mitlesen können alle, doch nur WPML-Kunden können hier Fragen veröffentlichen. Das WPML-Team antwortet im Forum an 6 Tagen pro Woche, 22 Stunden am Tag.

Dieses Thema enthält 7 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Prosenjit Barman Vor 1 Jahr, 2 Monaten.

Assistiert von: Prosenjit Barman.

Verfasser Beiträge
Januar 24, 2024 at 9:18 am #15220562

echtzeitG

When choosing another (translated) gift card template in the secondary language (EN) of a product, the template jumps back to the template choosen in the primary language after saving the product changes (see screenshot)

Thank you
youie

Bildschirmfoto 2024-01-24 um 10.12.27.png
Januar 25, 2024 at 12:52 pm #15226181

Prosenjit Barman
WPML-Unterstützer seit 03/2023

Sprachen: Englisch (English )

Zeitzone: Asia/Dhaka (GMT+06:00)

Hello Youie,
Thanks for contacting WPML Support.

We have been experiencing a high volume of tickets for the past couple of days which causes the delay in responding. Sorry for any inconvenience you had in the meantime.

I understand the issue you're having. While checking the WPML Debug Information, I noticed that you're currently using the PW WooCommerce Gift Card plugin. For your information, this plugin is not listed in our compatible plugin directory. You can check by going to this link: https://wpml.org/plugin/

However, It seems likely that the field for selecting the gift card template is configured to "Copy" in WPML Settings. As a result, the template chosen for the default product is copied to the Translated product.

Since the site information isn't fully showing in the WPML Debug Info, it's difficult to determine the exact name of the field. However, if you can identify the field name by inspecting it with the Browser developer tool, you might try the following steps to see if they assist in resolving the issue:

- Navigate to WPML > Settings and scroll down to the "Custom Field Translation" section.
- Click on the "Show System Fields" button.
- Look for the name of the field you identified.
- If you find that field in the results, change its translation preference to 'Translate' and then test to see if the issue is resolved.

Please let me know if that helps or if you need further assistance in this matter. I will be happy to help.

Best regards,
Prosenjit

Januar 29, 2024 at 8:04 am #15236398

echtzeitG

Hi Prosenjit,
thank you for your support – especially while having a lot of tickets!

I tried to change the custom fields that are shown and are created by the Pimwick Plugin. (please see screenshot)
Unfortunately, changing them to "copy“ or „translatable“ does not have any effect to the product page.

Do you have another idea?

Best regards

Uwe

Bildschirmfoto 2024-01-26 um 10.59.46.png
Januar 29, 2024 at 11:49 am #15237785

Prosenjit Barman
WPML-Unterstützer seit 03/2023

Sprachen: Englisch (English )

Zeitzone: Asia/Dhaka (GMT+06:00)

Hello Uwe,
Thank you for patiently trying out the suggestions.

After changing the translation settings of the fields to "Translate", did you attempt to resend the default product for translation again? If the problem continues despite the updated translation settings, this may indicate a compatibility problem, requiring further examination in our Sandbox environment.

Please try to recreate the issue in our sandbox environment. The Autologin URL to our sandbox is given below.

- versteckter Link

The WPML and the required plugins are installed there. Please install the Gift card plugin that you're using, make the same settings as your site on the sandbox, and then try to recreate the issue.

If you've managed to replicate the issue, could you please share the steps you took? I'll follow them to better understand the problem and do my best to help resolve it.

Looking forward to your response and I'm always here to help.

Best regards,
Prosenjit

Januar 29, 2024 at 2:50 pm #15239090

echtzeitG

Hi Prosenjit,

I tried to follow your instructions, bit it didn't help.
After that I installed the Gift card Plugin in the sandbox installation and tried again.

Thank you for your help.

Best regards
Uwe

Bildschirmfoto 2024-01-29 um 15.49.54.png
Januar 30, 2024 at 11:13 am #15242873

Prosenjit Barman
WPML-Unterstützer seit 03/2023

Sprachen: Englisch (English )

Zeitzone: Asia/Dhaka (GMT+06:00)

Hello Uwe,
Thank you for recreating the issue in the Sandbox.

Upon review, I discovered that each Email Design is assigned an ID. However, despite properly setting up the translation preferences for these IDs, it remains impossible to translate them from any interface.

However, given that this plugin is not officially recognized as compatible, there are concerns regarding its compatibility. I have brought this issue to the attention of our compatibility team for a more thorough examination. Rest assured, I will inform you as soon as I have more update on this.

Thank you for your patience andd kind cooperation in this matter.

Best regards,
Prosenjit

Januar 31, 2024 at 8:32 am #15247795

echtzeitG

Hello Prosenjit,

thank you very much to you and the team for your help!

Best regards

Uwe

Februar 8, 2024 at 2:42 am #15279488

Prosenjit Barman
WPML-Unterstützer seit 03/2023

Sprachen: Englisch (English )

Zeitzone: Asia/Dhaka (GMT+06:00)

Hello Uwe,
I hope you're doing well.

Our compatibility team has investigated and found a resolution for the problem. I have conducted tests in the Sandbox environment and can verify that the Gift Card template now appears correctly in each language.

Please try the following and let me know if you're getting the expected result or not.

- Please add the following code to the theme's functions.php file. It will enable the numbers to appear in the Advanced Translation Editor.

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

- Once added, go to "WPML > Settings > Custom Field Translation" and set "_pwgc_show_email_preview" custom field as 'Don't translate' and Set "_pwgc_email_design_ids" as 'Translate'. [Click on the "Show System Field" link to see those fields]

- Make a small change in the default product and save your changes. Then, proceed to retranslate the product. During this process, in the Translation editor, you will be able to see the template ID selected for the default product. As a translation of the ID value, add the template ID you want to use for the translated product, corresponding to the selected checkbox. For instance, if the "Standard" Email template was chosen for the default products, positioned first, its ID would be '0'. To assign the "Standard EN" template to the translated product, positioned seventh, use the ID '6'. When accessing "Email Designer" via 'Pimwick Plugins', the arrangement of Email templates reflects their respective IDs.

- Once the translation is completed, open .../wp-content/plugins/pw-gift-cards/includes/class-wc-product-pw-gift-card.php file and Look for line 172.

Change it from:

$original_product_id = icl_object_id( $this->get_id(), 'product', TRUE, $default_language );

To:

$original_product_id = apply_filters( 'wpml_object_id', $this->get_id(), 'product');

As you can see, there is not a simple workaround and the author already has some old integration code.

Since the solution worked in our sandbox, our compatibility team will reach out to the plugin author to take the next steps.

Please let me know the results. If you need further assistance or clarification in any particular steps, please feel free to let me know. I will be happy to help.

Best Regards,
Prosenjit