- Stato
- Risolto
- Segnalato per
- WPML Multilingual & Multicurrency for WooCommerce 4.12.6
- Risolto in
- WooCommerce Multilingual & Multicurrency 5.5.2
Panoramica del problema
WPML Multilingual & Multicurrency for WooCommerce ora ti permette di tradurre e mostrare le recensioni dei prodotti. Tuttavia, non è ancora possibile tradurre le risposte a queste recensioni.
Soluzione alternativa
Esegui un backup completo del tuo sito prima di procedere.
- Modifica il file wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/FrontEndHooks.php.
- Sostituisci:
private static function isNonEmptyReview( $comment ) { return Obj::prop( 'comment_content', $comment ) && Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment ); }Con:
private static function isNonEmptyReview( $comment ) { return Obj::prop( 'comment_content', $comment ) && Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment ) || Relation::propEq( 'comment_type', 'comment', $comment ); } - Quindi apri il file: wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/Mapper.php.
- Sostituisci:
private function getUnregisteredReviews() { // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared $q = "SELECT c.comment_ID, c.comment_post_ID, c.comment_content, c.comment_type, tr.language_code, st.name, st.value FROM {$this->wpdb->comments} AS c LEFT JOIN {$this->wpdb->prefix}icl_translations AS tr ON tr.element_id = c.comment_post_ID AND tr.element_type = 'post_product' LEFT JOIN {$this->wpdb->prefix}icl_strings AS st ON c.comment_content = st.value AND st.context = '" . FrontEndHooks::CONTEXT . "' WHERE c.comment_type = '" . FrontEndHooks::COMMENT_TYPE . "' AND st.name IS null"; return (array) $this->wpdb->get_results( $q ); }Con:
private function getUnregisteredReviews() { // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared $q = "SELECT c.comment_ID, c.comment_post_ID, c.comment_content, c.comment_type, tr.language_code, st.name, st.value FROM {$this->wpdb->comments} AS c LEFT JOIN {$this->wpdb->prefix}icl_translations AS tr ON tr.element_id = c.comment_post_ID AND tr.element_type = 'post_product' LEFT JOIN {$this->wpdb->prefix}icl_strings AS st ON c.comment_content = st.value AND st.context = '" . FrontEndHooks::CONTEXT . "' WHERE c.comment_type = '" . FrontEndHooks::COMMENT_TYPE . "' OR c.comment_type = 'comment' AND st.name IS null"; return (array) $this->wpdb->get_results( $q ); } - Infine, vai su WooCommerce → WooCommerce Multilingual → Stato e fai clic sul link Risoluzione dei problemi.
- Seleziona Registra le recensioni dei prodotti per le traduzioni.
- Fai clic sul pulsante Avvia.