- Status
- Resolvido
- Relatado para
- WPML Multilingual & Multicurrency for WooCommerce 4.12.6
- Resolvido em
- WooCommerce Multilingual & Multicurrency 5.5.2
Visão geral do problema
O WPML Multilingual & Multimoeda para WooCommerce agora permite que você traduza e exiba avaliações de produtos. No entanto, ainda não é possível traduzir as respostas a essas avaliações.
Solução alternativa
Por favor, faça um backup completo do seu site antes de prosseguir.
- Edite o arquivo wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/FrontEndHooks.php.
- Substitua:
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 ); } - Em seguida, abra o arquivo: wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/Mapper.php.
- Substitua:
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 ); } - Por fim, vá para WooCommerce → WooCommerce Multilingual → Status e clique no link Solução de problemas.
- Selecione Registrar avaliações de produtos para traduções.
- Clique no botão Iniciar.