Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • add_action('wp_footer', function() {
    if (!is_checkout()) return;
    ?>
    <script>
    function forcePacklinkTranslations() {
    if (typeof Packlink === 'undefined' || !Packlink.checkout) return;

    const translations = {
    "pickDropOff": "Sélectionner un point de retrait",
    "changeDropOff": "Changer de point de retrait",
    "dropOffTitle": "Le colis sera livré à :",
    "noDropOffLocationsMessage": "Aucun point de retrait n'est disponible pour l'adresse saisie"
    };

    // Dictionnaire des traductions pour les textes bruts
    const textMappings = {
    "Package will be delivered to:": translations.dropOffTitle,
    "No drop-off locations available for the provided address.": translations.noDropOffLocationsMessage
    };

    // Fonction pour mettre à jour tous les éléments
    function updateAllTexts() {
    // Traitement des boutons
    document.querySelectorAll('button, .button, [role="button"]').forEach(button => {
    const btnText = button.textContent.trim();
    if (btnText === "Change Drop-Off Location") {
    button.textContent = translations.changeDropOff;
    }
    if (btnText === "Select Drop-Off Location") {
    button.textContent = translations.pickDropOff;
    }
    });

    // Traitement des textes bruts avec TreeWalker pour meilleures performances
    const walker = document.createTreeWalker(
    document.body,
    NodeFilter.SHOW_TEXT,
    { acceptNode: function(node) {
    return node.nodeValue.trim() ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
    }},
    false
    );

    let node;
    while ((node = walker.nextNode())) {
    const originalText = node.nodeValue.trim();
    if (textMappings[originalText]) {
    node.nodeValue = node.nodeValue.replace(originalText, textMappings[originalText]);
    }
    }
    }

    // Observateur pour les modifications globales
    const globalObserver = new MutationObserver(() => updateAllTexts());

    // Configuration de l'observateur
    globalObserver.observe(document.body, {
    childList: true,
    subtree: true,
    characterData: true
    });

    // Surcharge des traductions Packlink
    Object.defineProperty(Packlink.checkout, '_translations', {
    value: translations,
    writable: false,
    configurable: false
    });

    // Initialisation
    updateAllTexts();
    }

    // Démarrage du système
    const init = () => {
    forcePacklinkTranslations();
    const interval = setInterval(forcePacklinkTranslations, 100);
    setTimeout(() => clearInterval(interval), 10000);
    };

    if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', init);
    } else {
    init();
    }
    </script>
    <?php
    }, 0);

    Voici le code à ajouter dans le fichier functions.php de votre thème enfant. Utilisez un thème enfant pour ne perdre les changements lors des mises à jour du thème.

    Ce système remplacera dynamiquement :

    • Les boutons “Change Drop-Off Location” et “Select Drop-Off Location”
    • Le texte “Package will be delivered to:”
    • Le message d’erreur “No drop-off locations available…”

    Et ce même si ces éléments sont ajoutés dynamiquement après le chargement initial de la page.

    • This reply was modified 1 year, 3 months ago by siteweb.

    Hi,
    The same for me.
    I am on multisite installation. Do I have to close it hundreds times ?
    Best regards

    Thread Starter siteweb

    (@siteweb)

    Perfect !
    Thank you.

    Thread Starter siteweb

    (@siteweb)

    Hi
    “Could you please let me know if the plugin itself works correctly?”
    Yes it seems to work.

    Here is my details

    PHP version: 7.4.23
    MailPoet Free version: 3.71.1
    MailPoet Premium version: N/A
    WordPress version: 5.8.1
    Database version: 10.3.31-MariaDB-1:10.3.31+maria~buster-log
    Web server: Apache
    Server OS: Linux xxx 5.4.0-72-generic #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64
    WP_MEMORY_LIMIT: 512M
    WP_MAX_MEMORY_LIMIT: 512M
    WP_DEBUG: false
    PHP max_execution_time: 160
    PHP memory_limit: 512M
    PHP upload_max_filesize: 1000M
    PHP post_max_size: 200M
    WordPress language: fr_FR
    Multisite environment?: Yes
    Current Theme: Beaver Builder Child Theme (version 1.0)
    Active Plugin names: mailpoet/mailpoet.php, ubermenu/ubermenu.php
    Sending Method: MailPoet
    Sending Frequency: 100 emails every 5 minutes
    Task Scheduler method: WordPress
    Cron ping URL: ?mailpoet_router&endpoint=cron_daemon&action=ping
    Total number of subscribers: 996
    Plugin installed at: 2021-02-10 16:21:31

    Hi,
    I can’t believe that the same issue revealed two years ago
    https://ww.wp.xz.cn/support/topic/template-not-found-7/
    is still an issue (after marking resolved), and one month after this request, it is still at the same point.
    Is this plugin maintained ?
    Where are you guys ?

    Thread Starter siteweb

    (@siteweb)

    Hi
    I have already done it with no effects. The thing is it works when changing the name, and we are logged out if not.

    Thread Starter siteweb

    (@siteweb)

    Ok, desabling enabling does’t change anything.
    So I created manually the tables and it works now.
    Thanks for your help

    Thread Starter siteweb

    (@siteweb)

    Hi,
    I checked in the database and none of the tables exist. I tried to desactivate activate the plugin and it did not create the tables. On the other hand I activated it for another site of my network, and it works.
    Maybe because it doesn’t work for the last one of my network, if there is a loop issue ?

Viewing 8 replies - 1 through 8 (of 8 total)