Esempio n. 1
0
 /**
  *
  */
 public function display_shortcodes()
 {
     if (is_page(Product_Vendor::$pv_options->get_option('orders_page')) && $this->can_view_orders) {
         wp_enqueue_script('jquery');
         $this->product_id = !empty($_GET['orders_for_product']) ? (int) $_GET['orders_for_product'] : false;
         $products = array($this->product_id);
         $_product = get_product($this->product_id);
         $children = $_product->get_children();
         if (!empty($children)) {
             $products = array_merge($products, $children);
             $products = array_unique($products);
         }
         $this->orders = PV_Queries::get_orders_for_products($products, array('vendor_id' => get_current_user_id()));
         add_action('init', array($this, 'verify_order_access'));
         add_shortcode('pv_orders', array($this, 'display_product_orders'));
         if ($this->can_export_csv && !empty($_POST['export_orders'])) {
             $this->download_csv();
         }
     }
 }