Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+02:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Itamar 6 months, 2 weeks ago.

Assisted by: Itamar.

Author Posts
August 2, 2024 at 3:44 pm #16034185

julienA-4

Background of the issue:
I found and fixed a bug in WCML code leading to this notice (and probably some side effects that I couldn't identify):

[02-Aug-2024 15:30:13 UTC] PHP Notice: Undefined property: stdClass::$_regular_price in /var/www/vhosts/edited.com/shop.edited.com/wp-includes/class-wp-list-util.php on line 192
[02-Aug-2024 15:30:13 UTC] PHP Notice: Undefined property: stdClass::$_sale_price in /var/www/vhosts/edited.com/shop.edited.com/wp-includes/class-wp-list-util.php on line 192
[02-Aug-2024 15:30:13 UTC] PHP Notice: Undefined property: stdClass::$_price in /var/www/vhosts/edited.com/shop.edited.com/wp-includes/class-wp-list-util.php on line 192

In class-wcml-custom-prices.php, line 132:

$prices = wp_list_pluck( wp_list_filter( $rows, [ 'meta_key' => $key . '_' . $currency ] ), $key . '_' . $currency, 'post_id' );
$defaults = wp_list_pluck( wp_list_filter( $rows, [ 'meta_key' => $key ] ), $key, 'post_id' );

Those 2 calls use $key to find the value, but it's wrong. At this line, the value is located into 'meta_value', see example below:
Array (
[0] => stdClass Object ( [post_id] => 4753 [meta_key] => _regular_price [meta_value] => 70 )
[3] => stdClass Object ( [post_id] => 4754 [meta_key] => _regular_price [meta_value] => 45 )
)

Fix is the following:
$prices = wp_list_pluck( wp_list_filter( $rows, [ 'meta_key' => $key . '_' . $currency ] ), 'meta_value', 'post_id' );
$defaults = wp_list_pluck( wp_list_filter( $rows, [ 'meta_key' => $key ] ), 'meta_value', 'post_id' );

Please let me know when it's integrated so that I don't lose my local changes with an update.

Symptoms:
PHP Notice: Undefined property: stdClass::$_regular_price, stdClass::$_sale_price, stdClass::$_price in /var/www/vhosts/adlice.com/shop.adlice.com/wp-includes/class-wp-list-util.php on line 192

Questions:
When will the fix be integrated so that I don't lose my local changes with an update?

August 4, 2024 at 7:17 pm #16037113

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Thanks for reporting this.

I'm consulting our second-tier supporters about this case and will update you once I have their reply.

Regards,
Itamar.

August 5, 2024 at 12:05 pm #16039831

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

This issue has been escalated to our developers. We will keep you updated on any news regarding this issue.

I appreciate your patience.
Itamar.

August 5, 2024 at 2:05 pm #16040641

julienA-4

Thanks. I have found and fixed another issue:

file class-wcml-multi-currency-reports.php, line 200 (function filter_dashboard_status_widget_sales_query)

$query['join'] .= " INNER JOIN {$this->wpdb->postmeta} AS currency_postmeta ON posts.ID = currency_postmeta.post_id";

From the Woocommerce code here (hidden link) we can see the table alias is ORDERS, not POSTS.

Fix:

$query['join'] .= " INNER JOIN {$this->wpdb->postmeta} AS currency_postmeta ON orders.ID = currency_postmeta.post_id";

August 6, 2024 at 12:17 pm #16043794

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Thanks for reporting this issue as well.

The issue has been escalated to our developers.

We'll keep you updated here on any news regarding this issue.

Regards,
Itamar.