[wp-trac] [WordPress Trac] #51398: Bug: Notice: Trying to get property ‘earnings’ of non-object...

WordPress Trac noreply at wordpress.org
Sat Sep 26 19:22:46 UTC 2020


#51398: Bug: Notice: Trying to get property ‘earnings’ of non-object...
-----------------------------+-----------------------------
 Reporter:  principianteweb  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I was having some trouble with my web so I decided to debug it and this is
 what I got:

 Notice: Trying to get property ‘earnings’ of non-object in
 /home4/consumol/public_html/wp-content/plugins/dokan-
 lite/includes/functions.php on line 376

 I’m not sure how to fix it but I’ll show you how does that line looks
 hoping you can help me (the line 376 is the one that says $earnings =
 $count->earnings; ) :

 $cache_group = ‘dokan_seller_data_’ . $seller_id;
 $cache_key = ‘dokan-earning-‘ . $seller_id;
 $earnings = wp_cache_get( $cache_key, $cache_group );

 if ( $earnings === false ) {
 $count = $wpdb->get_row(
 $wpdb->prepare( “SELECT SUM(order_total) as earnings FROM
 {$wpdb->prefix}dokan_orders WHERE seller_id = %d AND order_status IN(‘wc-
 completed’, ‘wc-processing’, ‘wc-on-hold’)”, $seller_id )
 );

 $earnings = $count->earnings;

 wp_cache_set( $cache_key, $earnings, $cache_group );
 dokan_cache_update_group( $cache_key, $cache_group );
 }

 return apply_filters( ‘dokan_seller_total_sales’, $earnings );
 }

 /**
 * Generate dokan sync table
 * @deprecated since 2.4.3
 * @global WPDB $wpdb
 */

 I had a thread on the forum and the developers (@sohanhossain and @rur165)
 asked me to create a support ticket so you can help me to solve my
 problem.

 My website: https://consumo-local.com.mx/leon/

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51398>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list