@karesz Hi, sorry but we don’t get PHP notices on our end. WHat version of PHP are you running? We are testing using PHP 7.2.18
Thread Starter
Karesz
(@karesz)
Hi
I’m on php 7.1 and query monitor shows me that notice
@karesz I will do some testing on this and will give you an update within the week
Thanks
@karesz Hi, we have tested some more but still could not replicate the PHP notices. We will keep a look out for this though and consider it on our next update though. Thanks for letting us know.
Hi @wooassist,
I can confirm I see the same notices appearing and have applied the same fixes as @karesz (as well as some additional fixes to the wccs-admin-export.php file). Perhaps it would be possible to update the plugin with the changes proposed assuming they do not cause any problems?
Here is an example of the notice:
Notice: id was called <strong>incorrectly</strong>. Order properties should not be accessed directly. Backtrace: include('wp-admin/edit-form-advanced.php'), do_meta_boxes, WC_Meta_Box_Order_Data::output, do_action('woocommerce_admin_order_data_after_billing_address'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Customer_Source->display_fields_order_edit, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong
Aside from the property updates I also had to add array_key_exists checks to $_POST[‘date[ssd]’] and $_POST[‘date[eed]’] to remove notices on export (which ultimately broke NGINX). i.e.
if( ( array_key_exists('date[ssd]', $_POST) && $_POST['date[ssd]'] ) ) {
$ssd = $_POST['date[ssd]'];
$StartDate = strtotime($ssd);
}
if( ( array_key_exists('date[eed]', $_POST) && $_POST['date[eed]'] ) ) {
$eed = $_POST['date[eed]'];
$EndDate = strtotime($eed);
}
Hope that’s helpful.
Just wondered whether you’d had a chance to look into this any further @wooassist ? You may need to turn on debugging and/or check your error logs to see the notices. Happy to provide a list of files and fixes required if it helps.
Hi @wooassist
Any update on this issue? I’m having to reapply the fixes every time a plugin update is released. Once again, I’m more than happy to list the fixes if required.
Thanks
Thread Starter
Karesz
(@karesz)
Hi @bbceg,
here is my list of fixes:
filename: wc-customer-source.php
// line 333:
$source = get_post_meta( $order->get_id(), 'wc_customer_source_checkout_field', true );
// line 334:
$other = get_post_meta( $order->get_id(), 'wc_customer_source_checkout_other_field', true );
and I needed to add a div in line 337, because if I edit the users address in the order it looks crapy, so put this in row 337
<div class="clear"></div>
filename: wccs-source-report-table.php
// line 153:
$other = get_post_meta( $order->get_id(), 'wc_customer_source_checkout_other_field', true );
// line 160:
'customer_name' => $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(),
filename: wccs-admin-export.php
// line 31-38:
if( ( array_key_exists('date[ssd]', $_POST) && $_POST['date[ssd]'] ) ) {
$ssd = $_POST['date[ssd]'];
$StartDate = strtotime($ssd);
}
if( ( array_key_exists('date[eed]', $_POST) && $_POST['date[eed]'] ) ) {
$eed = $_POST['date[eed]'];
$EndDate = strtotime($eed);
}
// line 68-76:
$order_id = $order->get_id();
$order_status = $order->get_status();
$cust_name = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
$customer_source = get_post_meta( $order->get_id(), 'wc_customer_source_checkout_field', true );
$other = get_post_meta( $order->get_id(), 'wc_customer_source_checkout_other_field', true );
$customer_source .= ( $customer_source == 'other' && $other ) ? ' - ' . $other : '';
$ordercreated = $order->get_date_created();
So please confirm, that your list is the same as mine π
-
This reply was modified 6 years, 2 months ago by
Karesz. Reason: code
Hi @karesz ,
Thanks for putting that together, they look like what I had (though they’ve all been lost since the last update). Are you reapplying each time or is there a better way I’m missing?
Thread Starter
Karesz
(@karesz)
Hi @bbceg
unfortunately I need to change it every time when I update the plugin. That was the reason why I wrote this, but the developer can’t reproduce it on his end. Luckily it is written here, so next time just copy and paste π
Thanks @karesz that is indeed useful.
@wooassist assuming you still can’t replicate, might you consider applying the fixes anyway and then seeing if anything is affected? I know this might seem a little backwards but it would be easy to rollback the changes if you had to. Just a thought.