function product_list() { ?> <div id="main_container"> <h2><?php echo _e("Products List"); ?> </h2> <?php global $wpdb; $user_id = get_current_user_id(); $wpmp_pid = ''; if (isset($_GET['pid'])) { $wpmp_pid = $_GET['pid']; } $product_auth = $wpdb->get_var("select post_author from {$wpdb->posts} where ID='" . $wpmp_pid . "'"); if (isset($_GET['page']) && isset($_GET['action'])) { if ($_GET['page'] = 'List' && $_GET['action'] == 'del' && $product_auth == $user_id) { if (delete_post_meta($wpmp_pid, '_sku')) { delete_post_meta($wpmp_pid, '_regular_price'); delete_post_meta($wpmp_pid, '_sale_price'); delete_post_meta($wpmp_pid, '_price'); delete_post_meta($wpmp_pid, '_sale_price_dates_from'); delete_post_meta($wpmp_pid, '_sale_price_dates_to'); delete_post_meta($wpmp_pid, '_downloadable'); delete_post_meta($wpmp_pid, '_virtual'); wp_delete_post($wpmp_pid); } } } $product = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type = 'product' and post_author='" . $user_id . "'"); ?> <table class="productlist"> <thead> <tr> <th><?php echo _e("Product Name"); ?> </th> <th><?php echo _e("Details"); ?> </th> <th><?php echo _e("Stock"); ?> </th> <th><?php echo _e("Product Status"); ?> </th> <th><?php echo _e("Price"); ?> </th> <th><?php echo _e("Image"); ?> </th> <th><?php echo _e("Action"); ?> </th> </tr> </thead> <tbody> <?php //echo "SELECT ID FROM $wpdb->posts WHERE post_title = '".get_option('wkmp_seller_login_page_tile')."' and post_type='page'" $page_name = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_title = '" . get_option('wkmp_seller_login_page_tile') . "' and post_type='page'"); $wpmp_obj2 = new MP_Form_Handler(); foreach ($product as $pro) { $product_price = get_post_meta($pro->ID, '_price', true); $product_stock = get_post_meta($pro->ID, '_stock_status', true); $stock_remain = get_post_meta($pro->ID, '_stock', true); /*$product_image=MP_Form_Handler::get_product_image($pro->ID,'_thumbnail_id');*/ $product_image = $wpmp_obj2->get_product_image($pro->ID, '_thumbnail_id'); ?> <tr> <td><?php echo $pro->post_title; ?> </td> <td style="word-break:break-all;"><?php echo $pro->post_excerpt; ?> </td> <td><?php echo isset($product_stock) ? $product_stock : ''; ?> </td> <td><?php echo $pro->post_status; ?> </td> <td><?php echo mp_price($product_price); ?> </td>
echo "<p>" . _e('No order found') . '</p>'; } } function top_billing_country() { global $wpdb; //$per_page = apply_filters( 'mppro_top_billing_country_per_page', $per_page); /*$per_page = MP_Report_Dashboard::per_page(); $postid=MP_Report_Dashboard::getOrderId();*/ $per_page = $this->per_page(); $postid = $this->getOrderId(); if ($postid != '' && $per_page != '') { $sql = "SELECT sum(woi.meta_value) AS 'Total',postmeta.meta_value AS 'BillingCountry',Count(*) AS 'OrderCount' FROM {$wpdb->prefix}woocommerce_order_itemmeta woi\r\t\t\t\t\t\tleft join {$wpdb->prefix}woocommerce_order_items wois on woi.order_item_id=wois.order_item_id\r\t\t\t\t\t\tleft join {$wpdb->prefix}postmeta as postmeta on postmeta.post_id=wois.order_id\r\t\t\t\t\t\tWHERE woi.meta_key='_line_total' AND wois.order_item_id in(" . $postid . ") AND postmeta.meta_key='_billing_country' \t\t \t\t\r\t\t\t\t\t\tGROUP BY postmeta.meta_value \r\t\t\t\t\t\tOrder By OrderCount DESC \t\t\t\t\t\r\t\t\t\t\t\tLIMIT {$per_page}"; $order_items = $wpdb->get_results($sql); } if (isset($order_items) && count($order_items) > 0) { $country = new WC_Countries(); ?> <table style="width:100%" class="dashboardtable"> <thead> <tr> <th><?php echo _e("Billing Country"); ?> </th> <th><?php echo _e("Order Count"); ?> </th> <th><?php echo _e("Amount"); ?> </th> </tr> </thead> <tbody> <?php foreach ($order_items as $key => $order_item) { if ($key % 2 == 1) { $alternate = "alternate "; } else { $alternate = ""; } ?> <tr class="<?php echo $alternate . "row_" . $key; ?> "> <td><?php echo $country->countries[$order_item->BillingCountry]; ?> </td> <td><?php echo $order_item->OrderCount; ?> </td> <td><?php