prefix}posts p LEFT JOIN {$wpdb->prefix}users u ON p.post_author = u.ID WHERE p.post_type = 'product'"; if ( $user_id ) $query .= $wpdb->prepare( " AND p.post_author = %d", $user_id ); $query .= " ORDER BY p.post_date DESC LIMIT 200"; $products = $wpdb->get_results( $query ); echo '

' . esc_html__( 'Vendor Products', 'vendorverse' ) . '

'; echo ''; echo ''; foreach ( $products as $p ) { $product = wc_get_product( $p->ID ); $sales = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}vv_system_orders WHERE product_id=%d", $p->ID ) ); $edit_url = admin_url( 'post.php?post=' . $p->ID . '&action=edit' ); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
IDTitleVendorPriceDateStatusSalesActions
' . esc_html( $p->ID ) . '' . esc_html( $p->post_title ) . '' . esc_html( $p->vendor_name ) . '' . ( $product ? wc_price( $product->get_price() ) : '—' ) . '' . esc_html( date( 'Y-m-d', strtotime( $p->post_date ) ) ) . '' . esc_html( $p->post_status ) . '' . esc_html( $sales ) . 'Edit'; echo ' View
'; } }