WPML
Trạng thái
Đã giải quyết
Được báo cáo cho
WPML Multilingual & Multicurrency for WooCommerce 4.8.0
Đã giải quyết trong
WooCommerce Multilingual 4.9.0-b1

Tổng quan về lỗi

Khi gửi email từ các plugin YITH Affiliate, YITH Giftcards, WCFM và có thể một số khác, bạn có thể gặp phải lỗi như sau:

PHP Fatal error:  Uncaught Error: Call to a member function get_id() on array in /public_html/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php:395

Giải pháp tạm thời

Các nhà phát triển của chúng tôi đang tiến hành khắc phục sự cố này.
Như một giải pháp tạm thời, và chỉ sau khi đảm bảo đã sao lưu toàn bộ trang web, bạn có thể truy cập wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php và thay đổi mã từ:

	public function get_email_translated_string( $key,
			$object, $language)
		{

		$context = 'admin_texts_woocommerce_' . $object->id . '_settings';
		$name    = '[woocommerce_' . $object->id . '_settings]' . $key;

		return $this->wcml_get_translated_email_string( $context, $name, $object->object->get_id(), $language );

thành mã này:

public function get_email_translated_string( $key, $object, $language ) {
    $context = 'admin_texts_woocommerce_' . $object->id . '_settings';
    $name = '[woocommerce_' . $object->id . '_settings]' . $key;

    $order_id = false;

    if ( method_exists( $object->object, 'get_id' ) ) {
        $order_id = $object->object->get_id();
    }

    if ( is_array( $object->object ) && isset( $object->object['ID'] ) ) {
        $order_id = $object->object['ID'];
    }

    return $this->wcml_get_translated_email_string( $context, $name, $order_id, $language );
}

Tất cả các lỗi đã ghi nhận →