Exemplo n.º 1
0
 protected function setOrdersWoocommerce()
 {
     include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/woocommerce/functionsWoocommerce.php';
     $time = strtotime($this->date . ' UTC');
     $dateInLocal = date("Y-m-d H:i:s", $time);
     global $wpdb;
     $rows = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_modified_gmt > '" . $dateInLocal . "' AND post_type = 'shop_order' order by post_modified_gmt ASC", ARRAY_A);
     $count = 0;
     //CREATE AN HOOK ON FUNCTION sc_orders_rows to allow customers to make changes
     $rows = apply_filters('sc_orders_rows', $rows, $this);
     foreach ($rows as $row) {
         //*if( getStatusName( $this->software, $row ) == 'on-hold' || getStatusName( $this->software, $row ) == 'processing' || getStatusName( $this->software, $row ) == 'completed' ) {
         if ($count < 100) {
             if (!isDownloadable($this->software, null, $row)) {
                 array_push($this->orders, new Order($this->software, $this->date, $row));
                 $count = $count + 1;
             }
         } else {
             break 1;
         }
         //}//*/
     }
 }
Exemplo n.º 2
0
 protected function setNumber($date)
 {
     $time = strtotime($date . ' UTC');
     $dateInLocal = date("Y-m-d H:i:s", $time);
     global $wpdb;
     $split = explode('.', $this->software->getVersion());
     if ($this->software->isCompatible()) {
         // Cas Shopperpress
         if ('shopperpress' == $this->software->getSoftware()) {
             $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "orderdata WHERE CONCAT(order_date,' ',order_time) > '" . $dateInLocal . "' order by CONCAT(order_date,' ',order_time) ASC");
             foreach ($orders as $order) {
                 $this->number++;
             }
         } else {
             if ('Shopp' == $this->software->getSoftware()) {
                 $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "shopp_purchase WHERE modified > '" . $dateInLocal . "' and (txnstatus = 'authed' or txnstatus = 'captured') order by modified ASC", ARRAY_A);
                 foreach ($orders as $order) {
                     $orderObj = new Order($this->software, $date, $order);
                     $array = $orderObj->getItems();
                     $this->number++;
                 }
             } else {
                 if ('Woocommerce' == $this->software->getSoftware()) {
                     include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/woocommerce/functionsWoocommerce.php';
                     $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_modified_gmt > '" . $dateInLocal . "' AND post_type = 'shop_order' order by post_modified_gmt ASC", ARRAY_A);
                     $count = 0;
                     foreach ($orders as $order) {
                         if ($count < 100) {
                             if (!isDownloadable($this->software, null, $order)) {
                                 $this->number++;
                                 $count = $count + 1;
                             }
                         } else {
                             break 1;
                         }
                     }
                 } else {
                     if ('WP eCommerce' == $this->software->getSoftware()) {
                         $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "wpsc_purchase_logs WHERE date > '" . $time . "' order by date ASC", ARRAY_A);
                         foreach ($orders as $order) {
                             $this->number++;
                         }
                     } else {
                         if ('Cart66 Lite' == $this->software->getSoftware()) {
                             $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "cart66_orders WHERE ordered_on > '" . $dateInLocal . "' order by ordered_on ASC", ARRAY_A);
                             foreach ($orders as $order) {
                                 $this->number++;
                             }
                         } else {
                             if ('Cart66 Pro' == $this->software->getSoftware()) {
                                 $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "cart66_orders WHERE ordered_on > '" . $dateInLocal . "' order by ordered_on ASC", ARRAY_A);
                                 foreach ($orders as $order) {
                                     $this->number++;
                                 }
                             } else {
                                 if ('Jigoshop' == $this->software->getSoftware()) {
                                     include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/jigoshop/functionsJigoshop.php';
                                     $orders = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_modified_gmt > '" . $dateInLocal . "' AND post_type = 'shop_order' order by post_modified_gmt ASC", ARRAY_A);
                                     foreach ($orders as $order) {
                                         $this->number++;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }