當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WCV_Vendors::count_due_by_vendor方法代碼示例

本文整理匯總了PHP中WCV_Vendors::count_due_by_vendor方法的典型用法代碼示例。如果您正苦於以下問題:PHP WCV_Vendors::count_due_by_vendor方法的具體用法?PHP WCV_Vendors::count_due_by_vendor怎麽用?PHP WCV_Vendors::count_due_by_vendor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WCV_Vendors的用法示例。


在下文中一共展示了WCV_Vendors::count_due_by_vendor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: log_commission_due

 /**
  * Store all commission due for an order
  *
  * @return bool
  *
  * @param int $order_id
  */
 public static function log_commission_due($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $dues = WCV_Vendors::get_vendor_dues_from_order($order, false);
     foreach ($dues as $vendor_id => $details) {
         // Only process vendor commission
         if (!WCV_Vendors::is_vendor($vendor_id)) {
             continue;
         }
         // See if they currently have an amount due
         $due = WCV_Vendors::count_due_by_vendor($vendor_id, $order_id);
         if ($due > 0) {
             continue;
         }
         // Get the dues in an easy format for inserting to our table
         $insert_due = array();
         foreach ($details as $key => $detail) {
             $product_id = $detail['product_id'];
             $insert_due[$product_id] = array('order_id' => $order_id, 'vendor_id' => $vendor_id, 'product_id' => $product_id, 'total_due' => !empty($insert_due[$product_id]['total_due']) ? $detail['commission'] + $insert_due[$product_id]['total_due'] : $detail['commission'], 'total_shipping' => !empty($insert_due[$product_id]['total_shipping']) ? $detail['shipping'] + $insert_due[$product_id]['total_shipping'] : $detail['shipping'], 'tax' => !empty($insert_due[$product_id]['tax']) ? $detail['tax'] + $insert_due[$product_id]['tax'] : $detail['tax'], 'qty' => !empty($insert_due[$product_id]['qty']) ? $detail['qty'] + $insert_due[$product_id]['qty'] : $detail['qty'], 'time' => $order->order_date);
         }
         if (!empty($insert_due)) {
             WCV_Commission::insert_new_commission(array_values($insert_due));
         }
     }
 }
開發者ID:sawanmeister,項目名稱:wcvendors,代碼行數:33,代碼來源:class-commission.php


注:本文中的WCV_Vendors::count_due_by_vendor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。