render_product_columns() public method

Ouput custom columns for products.
public render_product_columns ( string $column )
$column string
 public function get_wooc_product_data()
 {
     global $post, $the_product;
     $user_data = $this->user_data;
     $user_email = $user_data->email;
     $user_ID = $user_data->user_id;
     $orders_data = array();
     $order_products = array();
     include_once dirname(WC_PLUGIN_FILE) . '/includes/admin/class-wc-admin-post-types.php';
     $CPT_Product = new WC_Admin_Post_Types();
     $args = array('numberposts' => -1, 'post_type' => 'product', 'post_status' => 'publish');
     #$products = get_posts( $args );
     $products = wcrm_customer_bought_products($user_email, $user_ID);
     foreach ($products as $prod) {
         $post = get_post($prod->ID);
         $the_product = wc_get_product($prod->ID);
         if (!wc_customer_bought_product($user_email, $user_ID, $prod->ID)) {
             # continue;
         }
         $o['ID'] = $prod->ID;
         ob_start();
         $CPT_Product->render_product_columns('thumb');
         $o['thumb'] = ob_get_contents();
         ob_end_clean();
         ob_start();
         $edit_link = get_edit_post_link($prod->ID);
         $title = _draft_or_post_title();
         echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>';
         $o['name'] = ob_get_contents();
         ob_end_clean();
         ob_start();
         $CPT_Product->render_product_columns('sku');
         $o['sku'] = ob_get_contents();
         ob_end_clean();
         $o['number_purchased'] = $prod->items_count;
         $o['value_purchases'] = wc_price($prod->line_total);
         $orders_data[] = $o;
     }
     return $orders_data;
 }
 function get_wooc_product_data()
 {
     global $post, $woocommerce, $the_order;
     $orders_data = array();
     $order_products = array();
     if (defined('WC_VERSION') && floatval(WC_VERSION) >= 2.2) {
         include_once dirname(WC_PLUGIN_FILE) . '/includes/admin/class-wc-admin-post-types.php';
         $CPT_Product = new WC_Admin_Post_Types();
         $args = array('numberposts' => -1, 'post_type' => 'product', 'post_status' => 'publish');
         $products = get_posts($args);
         foreach ($products as $post) {
             #$post = get_post($prod_id);
             $o['ID'] = $post->ID;
             ob_start();
             $CPT_Product->render_product_columns('thumb');
             $o['thumb'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $edit_link = get_edit_post_link($post->ID);
             $title = _draft_or_post_title();
             echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>';
             $o['name'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->render_product_columns('sku');
             $o['sku'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->render_product_columns('is_in_stock');
             $o['is_in_stock'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->render_product_columns('price');
             $o['price'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->render_product_columns('product_cat');
             $o['product_cat'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->render_product_columns('product_type');
             $o['product_type'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             if ('0000-00-00 00:00:00' == $post->post_date) {
                 $t_time = $h_time = __('Unpublished', 'woocommerce');
             } else {
                 $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                 $gmt_time = strtotime($post->post_date_gmt . ' UTC');
                 $time_diff = current_time('timestamp', 1) - $gmt_time;
                 if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                     $h_time = sprintf(__('%s ago', 'woocommerce'), human_time_diff($gmt_time, current_time('timestamp', 1)));
                 } else {
                     $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                 }
             }
             echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
             $o['date'] = ob_get_contents();
             ob_end_clean();
             $orders_data[] = $o;
         }
     } else {
         $args = array('numberposts' => -1, 'post_type' => 'product', 'post_status' => 'publish');
         $args = $this->product_filters_query($args);
         $orders = get_posts($args);
         $CPT_Product = new WC_Admin_CPT_Product();
         $user_email = '';
         if (isset($_GET['order_id'])) {
             $user_order_id = $_GET['order_id'];
             $u = new WC_Order($user_order_id);
             $user_email = $u->billing_email;
             /**/
             $args_ = array('numberposts' => -1, 'post_type' => 'shop_order', 'post_status' => 'publish');
             $orders_ = get_posts($args_);
             foreach ($orders_ as $order_) {
                 $id = $order_->ID;
                 if (!empty($user_email)) {
                     $t = new WC_Order($id);
                     if ($user_email != $t->billing_email) {
                         continue;
                     }
                 }
                 $order_d = new WC_Order($order_->ID);
                 $items = $order_d->get_items();
                 foreach ($items as $item) {
                     $prod_id = $item['item_meta']['_product_id'][0];
                     if (!in_array($prod_id, $order_products)) {
                         $order_products[] = $prod_id;
                     }
                 }
             }
             /**/
         }
         foreach ($orders as $order) {
             $post = $order;
             if (!in_array($post->ID, $order_products)) {
                 continue;
             }
             $o['ID'] = $post->ID;
             ob_start();
             $CPT_Product->custom_columns('thumb');
             $o['thumb'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $edit_link = get_edit_post_link($post->ID);
             $title = _draft_or_post_title();
             echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>';
             $o['name'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->custom_columns('sku');
             $o['sku'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->custom_columns('is_in_stock');
             $o['is_in_stock'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->custom_columns('price');
             $o['price'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->custom_columns('product_cat');
             $o['product_cat'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             $CPT_Product->custom_columns('product_type');
             $o['product_type'] = ob_get_contents();
             ob_end_clean();
             ob_start();
             if ('0000-00-00 00:00:00' == $post->post_date) {
                 $t_time = $h_time = __('Unpublished', 'woocommerce');
             } else {
                 $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                 $gmt_time = strtotime($post->post_date_gmt . ' UTC');
                 $time_diff = current_time('timestamp', 1) - $gmt_time;
                 if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                     $h_time = sprintf(__('%s ago', 'woocommerce'), human_time_diff($gmt_time, current_time('timestamp', 1)));
                 } else {
                     $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                 }
             }
             echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
             $o['date'] = ob_get_contents();
             ob_end_clean();
             $orders_data[] = $o;
         }
     }
     return $orders_data;
 }