Support » Plugin: Translate Multilingual sites - TranslatePress » Corrupts PDF with Product Attachment for WooCommerce

  • Resolved erniecom

    (@erniecom)


    Above link is the production site but I can reproduced it with all of these conditions:

    • accessed with Chrome or Safari (any other?). Firefox works.
    • switched to English with TranslatePress. Default language Spanish works.
    • WP, WC, TranslatePress, Product Attachment for WooCommerce with 2021 theme

    To not discriminate between plug-ins and point the blaming finger I will post this also as an issue for Product Attachment for Woocommerce in the hope it it will facilitate collaboration.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support andrei202

    (@andrei202)

    Hello there,

    Thanks for reaching out about your issue.

    Translatepress shouldn’t be messing around with any of your files, one thing that might be happening is that it translates the download link but this is highly unlikely.

    Since this looks a lot like a conflict with some other code, the first/next recommended step is the conflict test (ideally in a staging environment):

    ​​*Briefly* disable all other plugins and enable the default Twenty Twenty theme. Please also disable all add-ons. If this fixes the problem, as it probably will, enable everything one by one, checking each time to see when the problem returns.

    Please let us know when you find the conflict so that we can take a look and see what we can do about it.

    Regards.

    Thread Starter erniecom

    (@erniecom)

    I have the latest WP with only enabled the latest theme 2020 and plugins WooCommerce, WooCommerce Product Attachment Premium (Premium) and TranslatePress – Multilingual. Disabling TranslatePress fixes the issue.

    Meanwhile the author of WooCommerce Product Attachment Premium (Premium) has responded with a promise to address this issue (from their side) in their next feature release. Again I post this to facilitate collaboration.

    Thread Starter erniecom

    (@erniecom)

    An update that this issue seems still unfixed for version 2.1.9 and WooCommerce Product Attachment 2.1.1.

    A work around is to use Javascript to change the link to always be the default language URL. In my case that is Spanish and the script changes /en/ to /es/ and it then will work correctly.

    jQuery(function($){
      // still needed for incompatibility between TranslatePress 2.1.9 and WooCommerce Product Attachment 2.1.1
      $("a.wcpoa_attachmentbtn").each(function(){
         var newUrl = $(this).attr('href').replace('/en/', '/es/');
         $(this).attr('href', newUrl);
      });
    });
    Thread Starter erniecom

    (@erniecom)

    The above work around is still valid but will not avoid certain error messages when search engine crawlers visit the site and try to follow the attachments links. Now Translate Press protests about this links because when accessed from the translated product (in my case English from original language Spanish) then at /wp-admin/admin.php?page=trp_error_manager you find a list of the last 5 errors this incompatibility bug is causing. Since they are all the same I give you just one example:

    last_error 	WordPress database error: Could not perform query because it contains invalid data.
    disable_automatic_translations 	Yes
    url 	https://foto-r3.com/en/product/kodak-gold-200-35mm-36-expo-c-41-x3-triple-pack/?attachment_id=21866&download_file=weyou8sugw96q
    details 	Error running get_untranslated_strings()
    date_time 	2022-02-06 22:33:36
    timestamp 	1644186816

    Please note that we now have a clue where this error might be taking place.

    Thread Starter erniecom

    (@erniecom)

    Just checked that version 2.2.1 in combination with WooCommerce Product Attachment version 2.1.2 still show the same issue here described. My JS work around is still valid.

    Unfortunately, we have the same issue , while using the translated language, any attempt to download the pdf file gives an corrupted file. Do you get any solation for this issue brother ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Corrupts PDF with Product Attachment for WooCommerce’ is closed to new replies.