Tổng quan về sự cố
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
Sự cố này đã được khắc phục trong WooCommerce Multilingual 4.9.0-b1. Việc cập nhật giải quyết vấn đề này trên trang web của bạn, vì vậy bạn chỉ cần giải pháp tạm thời này nếu chưa thể cập nhật.
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 );
}