/**
  * [wcv_vendor_dashboard] shortcode
  *
  * @param array $atts
  *
  * @return unknown
  */
 public function display_vendor_products($atts)
 {
     global $start_date, $end_date;
     $start_date = !empty($_SESSION['PV_Session']['start_date']) ? $_SESSION['PV_Session']['start_date'] : strtotime(date('Ymd', strtotime(date('Ym', current_time('timestamp')) . '01')));
     $end_date = !empty($_SESSION['PV_Session']['end_date']) ? $_SESSION['PV_Session']['end_date'] : strtotime(date('Ymd', current_time('timestamp')));
     $can_view_orders = WC_Vendors::$pv_options->get_option('can_show_orders');
     $settings_page = get_permalink(WC_Vendors::$pv_options->get_option('shop_settings_page'));
     $can_submit = WC_Vendors::$pv_options->get_option('can_submit_products');
     $submit_link = $can_submit ? admin_url('post-new.php?post_type=product') : '';
     $edit_link = $can_submit ? admin_url('edit.php?post_type=product') : '';
     if (!$this->can_view_vendor_page()) {
         return false;
     }
     extract(shortcode_atts(array('user_id' => get_current_user_id(), 'datepicker' => true), $atts));
     $vendor_products = WCV_Queries::get_commission_products($user_id);
     $products = array();
     foreach ($vendor_products as $_product) {
         $products[] = $_product->ID;
     }
     $vendor_summary = $this->format_product_details($vendor_products);
     $order_summary = WCV_Queries::get_orders_for_products($products);
     $shop_page = WCV_Vendors::get_vendor_shop_page(wp_get_current_user()->user_login);
     wp_enqueue_style('wcv_frontend_style', wcv_assets_url . 'css/wcv-frontend.css');
     $providers = array();
     $provider_array = array();
     // WC Shipment Tracking Providers
     if (class_exists('WC_Shipment_Tracking')) {
         $WC_Shipment_Tracking = new WC_Shipment_Tracking();
         $providers = $WC_Shipment_Tracking->get_providers();
         $provider_array = array();
         foreach ($providers as $all_providers) {
             foreach ($all_providers as $provider => $format) {
                 $provider_array[sanitize_title($provider)] = urlencode($format);
             }
         }
     }
     ob_start();
     do_action('wcvendors_before_dashboard');
     wc_print_notices();
     wc_get_template('links.php', array('shop_page' => urldecode($shop_page), 'settings_page' => $settings_page, 'can_submit' => $can_submit, 'submit_link' => $submit_link, 'edit_link' => $edit_link), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
     if ($can_view_sales = WC_Vendors::$pv_options->get_option('can_view_frontend_reports')) {
         wc_get_template('reports.php', array('start_date' => $start_date, 'end_date' => $end_date, 'vendor_products' => $vendor_products, 'vendor_summary' => $vendor_summary, 'datepicker' => $datepicker, 'can_view_orders' => $can_view_orders), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
     }
     wc_get_template('orders.php', array('start_date' => $start_date, 'end_date' => $end_date, 'vendor_products' => $vendor_products, 'order_summary' => $order_summary, 'datepicker' => $datepicker, 'providers' => $providers, 'provider_array' => $provider_array, 'can_view_orders' => $can_view_orders), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
     do_action('wcvendors_after_dashboard');
     if (function_exists('wc_enqueue_js')) {
         wc_enqueue_js(WCV_Vendor_dashboard::wc_st_js($provider_array));
     } else {
         $woocommerce->add_inline_js($js);
     }
     return ob_get_clean();
 }
 /**
  * Use views to display the Orders page
  *
  * @return html
  */
 public function display_product_orders()
 {
     if (!WCV_Vendors::is_vendor(get_current_user_id())) {
         ob_start();
         wc_get_template('denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/');
         return ob_get_clean();
     }
     if (empty($_GET['orders_for_product'])) {
         return __('You haven\'t selected a product\'s orders to view! Please go back to the Vendor Dashboard and click Show Orders on the product you\'d like to view.', 'wcvendors');
     }
     if (!$this->orders) {
         return __('No orders.', 'wcvendors');
     }
     if (!empty($_POST['submit_comment'])) {
         require_once wcv_plugin_dir . 'classes/front/orders/class-submit-comment.php';
         WCV_Submit_Comment::new_comment($this->orders);
     }
     if (isset($_POST['mark_shipped'])) {
         $order_id = (int) $_POST['order_id'];
         $product_id = (int) $_POST['product_id'];
         exit;
     }
     $headers = WCV_Orders::get_headers();
     $all = WCV_Orders::format_order_details($this->orders, $this->product_id);
     wp_enqueue_style('pv_frontend_style', wcv_assets_url . 'css/wcv-frontend.css');
     wp_enqueue_script('pv_frontend_script', wcv_assets_url . 'js/front-orders.js');
     $providers = array();
     $provider_array = array();
     // WC Shipment Tracking Providers
     if (class_exists('WC_Shipment_Tracking')) {
         $WC_Shipment_Tracking = new WC_Shipment_Tracking();
         $providers = $WC_Shipment_Tracking->get_providers();
         $provider_array = array();
         foreach ($providers as $all_providers) {
             foreach ($all_providers as $provider => $format) {
                 $provider_array[sanitize_title($provider)] = urlencode($format);
             }
         }
     }
     ob_start();
     // Show the Export CSV button
     if ($this->can_export_csv) {
         wc_get_template('csv-export.php', array(), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/');
     }
     wc_get_template('orders.php', array('headers' => $headers, 'body' => $all['body'], 'items' => $all['items'], 'product_id' => $all['product_id'], 'providers' => $providers, 'provider_array' => $provider_array), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/');
     return ob_get_clean();
 }