当前位置: 首页>>代码示例>>PHP>>正文


PHP WCV_Vendors::get_vendor_dues_from_order方法代码示例

本文整理汇总了PHP中WCV_Vendors::get_vendor_dues_from_order方法的典型用法代码示例。如果您正苦于以下问题:PHP WCV_Vendors::get_vendor_dues_from_order方法的具体用法?PHP WCV_Vendors::get_vendor_dues_from_order怎么用?PHP WCV_Vendors::get_vendor_dues_from_order使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WCV_Vendors的用法示例。


在下文中一共展示了WCV_Vendors::get_vendor_dues_from_order方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

示例2: manage_commissions_column_content

 function manage_commissions_column_content($column, $order_id)
 {
     if ('commissions' == $column) {
         $order = new WC_Order($order_id);
         $dues = WCV_Vendors::get_vendor_dues_from_order($order, false);
         foreach ($dues as $vendor_id => $details) {
             /*
             				$commission = 0;
             				$shipping = 0;
             				$tax = 0;*/
             $total = 0;
             foreach ($details as $value) {
                 /*
                 					$commission += $value['commission'];
                 					$shipping += $value['shipping'];
                 					$tax += $value['tax'];*/
                 $total += $value['total'];
             }
             echo sprintf("%01.2f € ", $total);
             $vendor = get_user_by('id', $vendor_id);
             echo __('for', 'wcvendors') . ' <a href="/wp-admin/user-edit.php?user_id=' . $vendor_id . '">' . $vendor->display_name . '</a>';
             echo '<br />';
         }
     }
 }
开发者ID:simplementNat,项目名称:wcvendors,代码行数:25,代码来源:class-wc-vendors.php

示例3: check_order_totals

 /**
  *
  *
  * @param unknown $total_rows
  * @param unknown $order
  *
  * @return unknown
  */
 function check_order_totals($total_rows, $order)
 {
     $commission_label = apply_filters('wcv_notify_vendor_commission_label', __('Commission Subtotal:', 'wcvendors'));
     $return['cart_subtotal'] = $total_rows['cart_subtotal'];
     $return['cart_subtotal']['label'] = $commission_label;
     if (WC_Vendors::$pv_options->get_option('give_tax')) {
         $return['tax_subtotal'] = array('label' => '', 'value' => '');
         $return['tax_subtotal']['label'] = apply_filters('wcv_notify_vendor_tax_label', __('Tax Subtotal:', 'wcvendors'));
     }
     $dues = WCV_Vendors::get_vendor_dues_from_order($order);
     foreach ($dues as $due) {
         if ($this->current_vendor == $due['vendor_id']) {
             if (!empty($return['shipping'])) {
                 $return['shipping'] = $total_rows['shipping'];
             }
             $return['shipping']['label'] = __('Shipping Subtotal:', 'wcvendors');
             $return['shipping']['value'] = woocommerce_price($due['shipping']);
             if (WC_Vendors::$pv_options->get_option('give_tax')) {
                 $return['tax_subtotal']['value'] += $due['tax'];
             }
             break;
         }
     }
     // Format tax price
     if (WC_Vendors::$pv_options->get_option('give_tax')) {
         $return['tax_subtotal']['value'] = woocommerce_price($return['tax_subtotal']['value']);
     }
     return $return;
 }
开发者ID:oleggen,项目名称:wcvendors,代码行数:37,代码来源:class-wc-notify-vendor.php

示例4: set_vendor_items

 /**
  *
  *
  * @param unknown $order
  * @param unknown $author_email
  * @param unknown $setPaymentOptionsRequest
  * @param unknown $is_admin (optional)
  *
  * @return unknown
  */
 public function set_vendor_items($order, $setPaymentOptionsRequest)
 {
     $receivers = WCV_Vendors::get_vendor_dues_from_order($order, false);
     $receivers_two = WCV_Vendors::get_vendor_dues_from_order($order);
     foreach ($receivers as $products) {
         $invoice_items = array();
         $shipping_given = $tax_given = 0;
         foreach ($products as $key => $product) {
             $product_id = $product['product_id'];
             $shipping_given += $product['shipping'];
             $tax_given += $product['tax'];
             $product['commission'] = round($product['commission'], 2);
             if (!empty($product['commission'])) {
                 $item = new InvoiceItem();
                 $item->name = get_the_title($product_id);
                 $item->identifier = $product_id;
                 $item->price = $product['commission'];
                 $item->itemPrice = round($product['commission'] / $product['qty'], 2);
                 $item->itemCount = $product['qty'];
                 $invoice_items[] = $item;
             }
         }
         if (empty($invoice_items)) {
             continue;
         }
         $receiverOptions = new ReceiverOptions();
         $setPaymentOptionsRequest->receiverOptions[] = $receiverOptions;
         // Set the current vendor
         $receiverId = new ReceiverIdentifier();
         $receiverId->email = $product['vendor_id'] == 1 ? $this->main_paypal : WCV_Vendors::get_vendor_paypal($product['vendor_id']);
         $receiverOptions->receiver = $receiverId;
         $receiverOptions->invoiceData = new InvoiceData();
         $receiverOptions->invoiceData->item = $invoice_items;
         $receiverOptions->invoiceData->totalTax = number_format($receivers_two[$product['vendor_id']]['tax'], 2);
         $receiverOptions->invoiceData->totalShipping = number_format($receivers_two[$product['vendor_id']]['shipping'], 2);
     }
     return $setPaymentOptionsRequest;
 }
开发者ID:stodorovic,项目名称:wcvendors,代码行数:48,代码来源:paypal_ap.php

示例5: check_order_totals

 /**
  *
  *
  * @param unknown $total_rows
  * @param unknown $order
  *
  * @return unknown
  */
 function check_order_totals($total_rows, $order)
 {
     $return['cart_subtotal'] = $total_rows['cart_subtotal'];
     $return['cart_subtotal']['label'] = __('Commission Subtotal:', 'wcvendors');
     $dues = WCV_Vendors::get_vendor_dues_from_order($order);
     foreach ($dues as $due) {
         if ($this->current_vendor == $due['vendor_id']) {
             if (!empty($return['shipping'])) {
                 $return['shipping'] = $total_rows['shipping'];
             }
             $return['shipping']['label'] = __('Shipping Subtotal:', 'wcvendors');
             $return['shipping']['value'] = woocommerce_price($due['shipping']);
             break;
         }
     }
     return $return;
 }
开发者ID:shubham79,项目名称:Jhintaak,代码行数:25,代码来源:class-wc-notify-vendor.php


注:本文中的WCV_Vendors::get_vendor_dues_from_order方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。