本文整理匯總了PHP中WCV_Vendors::get_vendor_paypal方法的典型用法代碼示例。如果您正苦於以下問題:PHP WCV_Vendors::get_vendor_paypal方法的具體用法?PHP WCV_Vendors::get_vendor_paypal怎麽用?PHP WCV_Vendors::get_vendor_paypal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCV_Vendors
的用法示例。
在下文中一共展示了WCV_Vendors::get_vendor_paypal方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}