- Status
- Gelöst
- Gemeldet für
- WPML Multilingual & Multicurrency for WooCommerce 4.12.6
- Gelöst in
- WooCommerce Multilingual & Multicurrency 5.5.2
Übersicht über das Problem
WPML Multilingual & Multicurrency for WooCommerce ermöglicht es Ihnen nun, Produktbewertungen zu übersetzen und anzuzeigen. Es ist jedoch noch nicht möglich, Antworten auf diese Bewertungen zu übersetzen.
Problemumgehung
Bitte erstellen Sie ein vollständiges Backup Ihrer Website, bevor Sie fortfahren.
- Bearbeiten Sie die Datei wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/FrontEndHooks.php.
- Ersetzen Sie:
private static function isNonEmptyReview( $comment ) { return Obj::prop( 'comment_content', $comment ) && Relation::propEq( 'comment_type', self::COMMENT_TYPE, $comment ); }durch:
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 ); } - Öffnen Sie dann die Datei wp-content/plugins/woocommerce-multilingual/classes/Reviews/Translations/Mapper.php.
- Ersetzen Sie:
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 ); }durch:
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 ); } - Gehen Sie abschließend zu WooCommerce → WooCommerce Multilingual → Status und klicken Sie auf den Link Fehlerbehebung.
- Wählen Sie Produktbewertungen für Übersetzungen registrieren.
- Klicken Sie auf die Schaltfläche Start.