WPML
Estado
Resuelto
Notificado para
WPML Multilingual & Multicurrency for WooCommerce 4.12.6
Resuelto en
WooCommerce Multilingual & Multicurrency 5.5.2

Resumen del problema

WPML Multilingual & Multicurrency for WooCommerce ahora le permite traducir y mostrar reseñas de productos. Sin embargo, aún no es posible traducir las respuestas a esas reseñas.

Solución alternativa

Por favor, haga una copia de seguridad completa de su sitio antes de continuar.


  1. Edite el archivo wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/FrontEndHooks.php.

  2. Reemplace:
    	private static function isNonEmptyReview( $comment ) {
    		return Obj::prop( 'comment_content', $comment )
    		       && Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment );
    	}

    Por:

    	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 );
    	}


  3. Luego, vaya al archivo: wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/Mapper.php.

  4. Reemplace:
    	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 );
    	}

    Por:

    	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 );
    	}


  5. Por último, vaya a WooCommerceWooCommerce MultilingualEstado y haga clic en el enlace Solución de problemas.

  6. Seleccione Register product reviews for translations.

  7. Haga clic en el botón Iniciar.

Todos los problemas conocidos →