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


PHP WC_Order::get_item_count方法代码示例

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


在下文中一共展示了WC_Order::get_item_count方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sv_wc_csv_export_add_item_count_data

/**
 * Add `item_count` column data
 *
 * @param array $order_data the original column data
 * @param \WC_Order $order the order object
 * @param \WC_Customer_Order_CSV_Export_Generator $csv_generator the generator instance
 * @return array - the updated column data
 */
function sv_wc_csv_export_add_item_count_data($order_data, $order, $csv_generator)
{
    $new_order_data = array();
    $one_row_per_item = false;
    $custom_data = array('item_count' => $order->get_item_count());
    if (version_compare(wc_customer_order_csv_export()->get_version(), '4.0.0', '<')) {
        // pre 4.0 compatibility
        $one_row_per_item = 'default_one_row_per_item' === $csv_generator->order_format || 'legacy_one_row_per_item' === $csv_generator->order_format;
    } elseif (isset($csv_generator->format_definition)) {
        // post 4.0 (requires 4.0.3+)
        $one_row_per_item = 'item' === $csv_generator->format_definition['row_type'];
    }
    if ($one_row_per_item) {
        foreach ($order_data as $data) {
            $new_order_data[] = array_merge((array) $data, $custom_data);
        }
    } else {
        $new_order_data = array_merge($order_data, $custom_data);
    }
    return $new_order_data;
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:29,代码来源:add-order-item-count-column.php

示例2: process_payment

 public function process_payment($order_id)
 {
     if (!$this->is_currency_supported()) {
         throw new Exception(__('You cannot use this currency with LINE Pay.', 'wc-payment-gateway-line-pay'));
     }
     $order = new WC_Order($order_id);
     $items = $order->get_items();
     reset($items);
     $first_item = $items[key($items)];
     $item_name = $first_item['name'];
     $item_count = $order->get_item_count();
     $product_name = $item_name;
     if ($item_count > 1) {
         $product_name .= sprintf(__(' and %s others', 'wc-payment-gateway-line-pay'), $item_count - 1);
     }
     $response_data = $this->client->reserve($product_name, $this->product_image_url, $order->get_total(), get_woocommerce_currency(), add_query_arg('wc-api', 'linepay_confirm_url', home_url('/')), $order->get_checkout_payment_url(), $order_id, $this->get_option('langCd'));
     if ($response_data->returnCode != '0000') {
         throw new Exception(sprintf(__('Incorrect parameters were passed during checkout. Please contact site administrator. Return code: %s', 'wc-payment-gateway-line-pay'), $response_data->returnCode));
     }
     update_post_meta($order_id, '_hpd_linepay_transactionId', $response_data->info->transactionId);
     WC()->cart->empty_cart();
     return array('result' => 'success', 'redirect' => $response_data->info->paymentUrl->web);
 }
开发者ID:neltseng,项目名称:wc-payment-gateway-line-pay,代码行数:23,代码来源:class-hpd-linepay-gateway.php

示例3: foreach

				<th class="order-actions">&nbsp;</th>
			</tr>
		</thead>

		<tbody><?php 
    //echo "hiiiiiiii";
    //print_r($order_ids);
    //$user_product_bought=fused_has_user_bought(6,$order_userids);
    //print_r($user_product_bought);
    //$order = new WC_Order();
    //print_r($order_userids);
    foreach ($customer_orders as $customer_order) {
        $order = new WC_Order();
        $order->populate($customer_order);
        $status = get_term_by('slug', $order->status, 'shop_order_status');
        $item_count = $order->get_item_count();
        ?>
<tr class="order">
					<td class="order-number">
						<a href="<?php 
        echo esc_url(add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))));
        ?>
">
							<?php 
        echo $order->get_order_number();
        ?>
						</a>
					</td>
					<td class="order-date">
						<time datetime="<?php 
        echo date('Y-m-d', strtotime($order->order_date));
开发者ID:par-orillonsoft,项目名称:elearning-wordpress,代码行数:31,代码来源:my-orders.php

示例4: make_pickup_request

 public function make_pickup_request($order_id)
 {
     $order = new WC_Order($order_id);
     $soapClient = new SoapClient(__DIR__ . '/Shipping.wsdl');
     date_default_timezone_set('Asia/Calcutta');
     $time = current_time('H', true);
     $day = current_time('N');
     //If greater than 3:00 PM
     if ($time >= 15) {
         $offset = " + 2 days";
         $order->add_order_note('Order placed after 3:00 PM cut off time');
     } else {
         $offset = ' + 1 days';
         $order->add_order_note('Order placed before 3:00 PM cut off time');
     }
     switch ($day) {
         case '5':
             $offset = ' + 3 days';
             break;
         case '6':
             $offset = ' + 2 days';
             break;
         case '7':
             $offset = ' + 2 days';
             break;
         default:
             break;
     }
     $format = 'Y-m-d\\TH:i:s';
     $pickupdate = date($format, strtotime(date("Y-m-d H:i:s", mktime(11, 30, 0)) . $offset));
     $readytime = date($format, strtotime(date("Y-m-d H:i:s", mktime(12, 30, 0)) . $offset));
     $lastpickuptime = strtotime(date($format, strtotime(date("Y-m-d H:i:s", mktime(17, 30, 0)) . $offset)));
     $closingtime = strtotime(date($format, strtotime(date("Y-m-d H:i:s", mktime(19, 00, 0)) . $offset)));
     $shippingdatetime = $pickupdate;
     $order->add_order_note("Pick up request time:" . date("Y-m-d H:i:s", strtotime($pickupdate)));
     $params = array('Pickup' => array('PickupAddress' => array('Line1' => $this->address_1, 'Line2' => $this->address_2, 'Line3' => $this->address_3, 'City' => $this->city, 'StateOrProvinceCode' => $this->state, 'PostCode' => $this->postcode, 'CountryCode' => $this->country), 'PickupContact' => array('Department' => $this->dept, 'PersonName' => $this->contact_name, 'Title' => $this->contact_title, 'CompanyName' => $this->company_name, 'PhoneNumber1' => $this->phonenumber1, 'PhoneNumber1Ext' => $this->phonenumber1ext, 'PhoneNumber2' => $this->phonenumber2, 'PhoneNumber2Ext' => $this->phonenumber2ext, 'FaxNumber' => $this->faxnumber, 'CellPhone' => $this->cellphone, 'EmailAddress' => $this->emailaddress, 'Type' => ''), 'PickupLocation' => 'Reception', 'PickupDate' => $pickupdate, 'ReadyTime' => $readytime, 'LastPickupTime' => $lastpickuptime, 'ClosingTime' => $closingtime, 'ShippingDateTime' => $shippingdatetime, 'Comments' => '', 'Reference1' => $order_id, 'Reference2' => '', 'Vehicle' => '', 'Status' => 'Ready', 'PickupItems' => array('PickupItemDetail' => array('ProductGroup' => 'DOM', 'ProductType' => 'ONP', 'Payment' => 'P', 'NumberOfShipments' => 1, 'PackageType' => '', 'NumberOfPieces' => $order->get_item_count(), 'Comments' => '', 'ShipmentWeight' => array('Value' => 0.5, 'Unit' => 'Kg'), 'ShipmentVolume' => array('Value' => 0.5, 'Unit' => 'Kg'), 'CashAmount' => array('Value' => 0, 'CurrencyCode' => ''), 'ExtraCharges' => array('Value' => 0, 'CurrencyCode' => ''), 'ShipmentDimensions' => array('Length' => 0, 'Width' => 0, 'Height' => 0, 'Unit' => 'cm')))), 'ClientInfo' => array('AccountCountryCode' => $this->country, 'AccountEntity' => $this->entity, 'AccountNumber' => $this->account_num, 'AccountPin' => $this->pin, 'UserName' => $this->username, 'Password' => $this->password, 'Version' => 'v1.0'), 'Transaction' => array('Reference1' => $order_id, 'Reference2' => '', 'Reference3' => '', 'Reference4' => '', 'Reference5' => ''), 'LabelInfo' => Null);
     update_post_meta($order_id, 'aramex_pickup_request', json_encode($params));
     try {
         $auth_call = $soapClient->CreatePickup($params);
         update_post_meta($order_id, 'aramex_pickup_response', json_encode($auth_call));
         if (empty($auth_call->HasErrors) || $auth_call->HasErrors == 0) {
             $pickup_id = $auth_call->ProcessedPickup->ID;
             $pickup_guid = $auth_call->ProcessedPickup->GUID;
             $order->add_order_note("Aramex Pickup Request Successful <br> \n                    Pickup Request ID:" . $pickup_id . "<br>Pickup Request GUID:" . $pickup_guid);
             update_post_meta($order_id, 'pickup_id', $pickup_id);
             update_post_meta($order_id, 'pickup_guid', $pickup_guid);
         } else {
             $msg = "Aramex Pickup Request Failed due to the following error(s):<br>";
             foreach ($auth_call->Notifications as $notification) {
                 $msg .= "Error " . $notification->Code . ": " . $notification->Message . "<br>";
             }
             $order->add_order_note($msg);
             if ($this->verbose_reporting == true) {
                 wp_mail(get_bloginfo('admin_email'), 'Pick up request failed. Order ID:' . $order_id, $msg);
             }
         }
     } catch (SoapFault $fault) {
         $order->add_order_note("Failed creating Aramex pickup request. Error:" . $fault->faultstring);
         $message = "The system was unable to create an Aramex pickup request for Order ID" . $order_id . "/r/n The error we received from Aramex is as follows:/r/n" . $fault->faultstring . "/r/n";
         if ($this->verbose_reporting == true) {
             wp_mail(get_bloginfo('admin_email'), 'Pick up request failed. Order ID:' . $order_id, $message);
         }
     }
 }
开发者ID:siddkb,项目名称:WooCommerceAramexShippingIntegration,代码行数:64,代码来源:class-wc-integration-aramex-integration.php

示例5: get_order_data

 /**
  * Get the order data for the given ID.
  *
  * @since  2.5.0
  * @param  WC_Order $order The order instance
  * @return array
  */
 protected function get_order_data($order)
 {
     $order_post = get_post($order->id);
     $dp = wc_get_price_decimals();
     $order_data = array('id' => $order->id, 'order_number' => $order->get_order_number(), 'created_at' => $this->format_datetime($order_post->post_date_gmt), 'updated_at' => $this->format_datetime($order_post->post_modified_gmt), 'completed_at' => $this->format_datetime($order->completed_date, true), 'status' => $order->get_status(), 'currency' => $order->get_order_currency(), 'total' => wc_format_decimal($order->get_total(), $dp), 'subtotal' => wc_format_decimal($order->get_subtotal(), $dp), 'total_line_items_quantity' => $order->get_item_count(), 'total_tax' => wc_format_decimal($order->get_total_tax(), $dp), 'total_shipping' => wc_format_decimal($order->get_total_shipping(), $dp), 'cart_tax' => wc_format_decimal($order->get_cart_tax(), $dp), 'shipping_tax' => wc_format_decimal($order->get_shipping_tax(), $dp), 'total_discount' => wc_format_decimal($order->get_total_discount(), $dp), 'shipping_methods' => $order->get_shipping_method(), 'payment_details' => array('method_id' => $order->payment_method, 'method_title' => $order->payment_method_title, 'paid' => isset($order->paid_date)), 'billing_address' => array('first_name' => $order->billing_first_name, 'last_name' => $order->billing_last_name, 'company' => $order->billing_company, 'address_1' => $order->billing_address_1, 'address_2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'postcode' => $order->billing_postcode, 'country' => $order->billing_country, 'email' => $order->billing_email, 'phone' => $order->billing_phone), 'shipping_address' => array('first_name' => $order->shipping_first_name, 'last_name' => $order->shipping_last_name, 'company' => $order->shipping_company, 'address_1' => $order->shipping_address_1, 'address_2' => $order->shipping_address_2, 'city' => $order->shipping_city, 'state' => $order->shipping_state, 'postcode' => $order->shipping_postcode, 'country' => $order->shipping_country), 'note' => $order->customer_note, 'customer_ip' => $order->customer_ip_address, 'customer_user_agent' => $order->customer_user_agent, 'customer_id' => $order->get_user_id(), 'view_order_url' => $order->get_view_order_url(), 'line_items' => array(), 'shipping_lines' => array(), 'tax_lines' => array(), 'fee_lines' => array(), 'coupon_lines' => array());
     // add line items
     foreach ($order->get_items() as $item_id => $item) {
         $product = $order->get_product_from_item($item);
         $product_id = null;
         $product_sku = null;
         // Check if the product exists.
         if (is_object($product)) {
             $product_id = isset($product->variation_id) ? $product->variation_id : $product->id;
             $product_sku = $product->get_sku();
         }
         $meta = new WC_Order_Item_Meta($item, $product);
         $item_meta = array();
         foreach ($meta->get_formatted(null) as $meta_key => $formatted_meta) {
             $item_meta[] = array('key' => $meta_key, 'label' => $formatted_meta['label'], 'value' => $formatted_meta['value']);
         }
         $order_data['line_items'][] = array('id' => $item_id, 'subtotal' => wc_format_decimal($order->get_line_subtotal($item, false, false), $dp), 'subtotal_tax' => wc_format_decimal($item['line_subtotal_tax'], $dp), 'total' => wc_format_decimal($order->get_line_total($item, false, false), $dp), 'total_tax' => wc_format_decimal($item['line_tax'], $dp), 'price' => wc_format_decimal($order->get_item_total($item, false, false), $dp), 'quantity' => wc_stock_amount($item['qty']), 'tax_class' => !empty($item['tax_class']) ? $item['tax_class'] : null, 'name' => $item['name'], 'product_id' => $product_id, 'sku' => $product_sku, 'meta' => $item_meta);
     }
     // Add shipping.
     foreach ($order->get_shipping_methods() as $shipping_item_id => $shipping_item) {
         $order_data['shipping_lines'][] = array('id' => $shipping_item_id, 'method_id' => $shipping_item['method_id'], 'method_title' => $shipping_item['name'], 'total' => wc_format_decimal($shipping_item['cost'], $dp));
     }
     // Add taxes.
     foreach ($order->get_tax_totals() as $tax_code => $tax) {
         $order_data['tax_lines'][] = array('id' => $tax->id, 'rate_id' => $tax->rate_id, 'code' => $tax_code, 'title' => $tax->label, 'total' => wc_format_decimal($tax->amount, $dp), 'compound' => (bool) $tax->is_compound);
     }
     // Add fees.
     foreach ($order->get_fees() as $fee_item_id => $fee_item) {
         $order_data['fee_lines'][] = array('id' => $fee_item_id, 'title' => $fee_item['name'], 'tax_class' => !empty($fee_item['tax_class']) ? $fee_item['tax_class'] : null, 'total' => wc_format_decimal($order->get_line_total($fee_item), $dp), 'total_tax' => wc_format_decimal($order->get_line_tax($fee_item), $dp));
     }
     // Add coupons.
     foreach ($order->get_items('coupon') as $coupon_item_id => $coupon_item) {
         $order_data['coupon_lines'][] = array('id' => $coupon_item_id, 'code' => $coupon_item['name'], 'amount' => wc_format_decimal($coupon_item['discount_amount'], $dp));
     }
     $order_data = apply_filters('woocommerce_cli_order_data', $order_data);
     return $this->flatten_array($order_data);
 }
开发者ID:jgcopple,项目名称:drgaryschwantz,代码行数:48,代码来源:class-wc-cli-order.php

示例6:

 /**
  * Test: get_item_count
  */
 function test_get_item_count()
 {
     $object = new WC_Order();
     $item_1 = new WC_Order_Item_Product();
     $item_1->set_props(array('product' => WC_Helper_Product::create_simple_product(), 'quantity' => 4));
     $item_2 = new WC_Order_Item_Product();
     $item_2->set_props(array('product' => WC_Helper_Product::create_simple_product(), 'quantity' => 2));
     $object->add_item($item_1);
     $object->add_item($item_2);
     $object->save();
     $this->assertEquals(6, $object->get_item_count());
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:15,代码来源:crud.php

示例7: array


//.........这里部分代码省略.........
				<th class="order-status"><span class="nobr"><?php 
                _e('Stato', 'woocommerce');
                ?>
</span></th>
				<th class="order-total"><span class="nobr"><?php 
                _e('Totale', 'woocommerce');
                ?>
</span></th>
                <th class="order-actions"><span class="nobr"><?php 
                _e('Prodotti / Attributi / Totale', 'woocommerce');
                ?>
</span></th>
				<th class="order-actions"><span class="nobr"><?php 
                _e('Dettagli', 'woocommerce');
                ?>
</span></th>
                <th class="order-actions"><span class="nobr"><?php 
                _e('Annullare', 'woocommerce');
                ?>
</span></th>
			</tr>
		</thead>

 <style>
								
								.hentry img { height: auto; max-width: 35%;}
								.woocommerce-message { display:none;}
						    </style>
		<tbody><?php 
                foreach ($customer_orders as $customer_order) {
                    $order = new WC_Order();
                    $order->populate($customer_order);
                    $status = get_term_by('slug', $order->status, 'shop_order_status');
                    $item_count = $order->get_item_count();
                    ?>
<tr class="order">
					<td class="order-number">
						<a href="<?php 
                    echo $order->get_view_order_url();
                    ?>
">
							<?php 
                    echo $order->get_order_number();
                    ?>
						</a>
					</td>
					<td class="order-date">
						<time datetime="<?php 
                    echo date('Y-m-d', strtotime($order->order_date));
                    ?>
" title="<?php 
                    echo esc_attr(strtotime($order->order_date));
                    ?>
"><?php 
                    echo date_i18n(get_option('date_format'), strtotime($order->order_date));
                    ?>
</time>
					</td>
					<td class="order-status" style="text-align:left; text-transform:uppercase; white-space:nowrap; color:#0C0"  >
						<?php 
                    echo ucfirst(__($status->name, 'woocommerce'));
                    ?>
					</td>
					<td class="order-total">
						<?php 
                    echo sprintf(_n('<strong>%s</strong> x <strong>%s Prodotto</strong>', '%s for %s items', $item_count, 'woocommerce'), $order->get_formatted_order_total(), $item_count);
开发者ID:sawan34,项目名称:tanzi,代码行数:67,代码来源:inventory.php

示例8: get_order_name

 protected function get_order_name(\WC_Order $order)
 {
     $item_count = $order->get_item_count();
     if (!$item_count) {
         throw new \LogicException('items are empty!');
     }
     $items = $order->get_items();
     $first_item = reset($items);
     if ($item_count == 1) {
         $order_name = $first_item['name'];
     } else {
         $fmt = _n('외 %d개 상품', '외 %d개 상품들', $item_count - 1, 'wskl');
         $order_name = $first_item['name'] . sprintf($fmt, $item_count - 1);
     }
     return $order_name;
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:16,代码来源:class-pg-iamport-common.php

示例9: check_type_of_product

function check_type_of_product($order_id)
{
    create_xero_invoice($order_id);
    if (!is_Null) {
        $order = NULL;
    }
    global $post;
    $order = new WC_Order($order_id);
    $items = $order->get_items();
    $OrderItemIds = array_keys($items);
    $numberOfItems = $order->get_item_count();
    $counter = 0;
    foreach ($items as $item) {
        $orderItemId = $OrderItemIds[$counter];
        $product = $order->get_product_from_item($item);
        $productAttributes = $product->get_attributes();
        if (!is_null($productAttributes['webinarid']['value'])) {
            $webinarId = $productAttributes['webinarid']['value'];
        } else {
            $webinarId = NULL;
        }
        if (!is_null($webinarId)) {
            $billingAddress = $order->get_formatted_billing_address();
            $firstName = $item['item_meta']['firstName'][0];
            $lastName = $item['item_meta']['lastName'][0];
            $email = $item['item_meta']['email'][0];
            $citrix = new CitrixAPI('5d8ab3cea37233d7d97dc1db5994fc9c', '8876575418305764356');
            $registerAttendee = $citrix->createRegistrant($webinarId, $firstName, $lastName, $email);
        } else {
            $userID = $order->customer_user;
            $adviserEmail = $order->billing_email;
            $billingAddressFormatted = $order->get_formatted_billing_address();
            $billingAddress = $order->get_billing_address();
            $billingName = $order->billing_first_name . ' ' . $order->billing_last_name;
            //$billingFormatted;//
            $billingCompany = $order->billing_company;
            $billing_phone = $order->billing_phone;
            if (!is_null($order->billing_address_1)) {
                $billingAddress1 = $order->billing_address_1;
            } else {
                $billingAddress1 = '';
            }
            if (!is_null($order->billing_address_2)) {
                $billingAddress2 = $order->billing_address_2;
            } else {
                $billingAddress2 = '';
            }
            if (!is_null($order->billing_city)) {
                $billingCity = $order->billing_city;
            } else {
                $billingCity = '';
            }
            if (!is_null($order->billing_state)) {
                $billingState = $order->billing_state;
            } else {
                $billingState = '';
            }
            if (!is_null($order->billing_postcode)) {
                $billingPostcode = $order->billing_postcode;
            } else {
                $billingPostcode = '';
            }
            //if virtual product, post data to server as well.
            //$isVirtual = $product->is_virtual();
            //if($isVirtual){
            //$emailToAdmin = 0;
            //post_item_data_to_server($order_id, $orderItemId, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode, $emailToAdmin);
            //}
            //24 April 2014 - Altered so that all orders post data when complete so that I can auto-complete all orders, not just electronic ones.
            post_item_data_to_server($order_id, $orderItemId, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode, $emailToAdmin);
            generate_docs_on_data_server($order_id, $orderItemId, $product, $adviserEmail, $userID, $item, $billingAddressFormatted, $billingAddress, $billingName, $billingCompany, $billing_phone, $billingAddress1, $billingAddress2, $billingCity, $billingState, $billingPostcode);
        }
        $counter = $counter + 1;
    }
    $order = NULL;
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:76,代码来源:woo-functions.php

示例10: dokan_order_show_suborders

/**
 * Show sub-orders on a parent order if available
 *
 * @param WC_Order $parent_order
 * @return void
 */
function dokan_order_show_suborders($parent_order)
{
    $sub_orders = get_children(array('post_parent' => $parent_order->id, 'post_type' => 'shop_order', 'post_status' => array('wc-pending', 'wc-completed', 'wc-processing', 'wc-on-hold')));
    if (!$sub_orders) {
        return;
    }
    ?>
    <header>
        <h2><?php 
    _e('Sub Orders', 'dokan');
    ?>
</h2>
    </header>

    <div class="dokan-info">
        <strong><?php 
    _e('Note:', 'dokan');
    ?>
</strong>
        <?php 
    _e('This order has products from multiple vendors/sellers. So we divided this order into multiple seller orders.
        Each order will be handled by their respective seller independently.', 'dokan');
    ?>
    </div>

    <table class="shop_table my_account_orders table table-striped">

        <thead>
            <tr>
                <th class="order-number"><span class="nobr"><?php 
    _e('Order', 'dokan');
    ?>
</span></th>
                <th class="order-date"><span class="nobr"><?php 
    _e('Date', 'dokan');
    ?>
</span></th>
                <th class="order-status"><span class="nobr"><?php 
    _e('Status', 'dokan');
    ?>
</span></th>
                <th class="order-total"><span class="nobr"><?php 
    _e('Total', 'dokan');
    ?>
</span></th>
                <th class="order-actions">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
        <?php 
    $statuses = wc_get_order_statuses();
    foreach ($sub_orders as $order_post) {
        $order = new WC_Order($order_post->ID);
        $item_count = $order->get_item_count();
        ?>
                <tr class="order">
                    <td class="order-number">
                        <a href="<?php 
        echo $order->get_view_order_url();
        ?>
">
                            <?php 
        echo $order->get_order_number();
        ?>
                        </a>
                    </td>
                    <td class="order-date">
                        <time datetime="<?php 
        echo date('Y-m-d', strtotime($order->order_date));
        ?>
" title="<?php 
        echo esc_attr(strtotime($order->order_date));
        ?>
"><?php 
        echo date_i18n(get_option('date_format'), strtotime($order->order_date));
        ?>
</time>
                    </td>
                    <td class="order-status" style="text-align:left; white-space:nowrap;">
                        <?php 
        echo isset($statuses[$order->post_status]) ? $statuses[$order->post_status] : $order->post_status;
        ?>
                    </td>
                    <td class="order-total">
                        <?php 
        echo sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'woocommerce'), $order->get_formatted_order_total(), $item_count);
        ?>
                    </td>
                    <td class="order-actions">
                        <?php 
        $actions = array();
        $actions['view'] = array('url' => $order->get_view_order_url(), 'name' => __('View', 'dokan'));
        $actions = apply_filters('dokan_my_account_my_sub_orders_actions', $actions, $order);
        foreach ($actions as $key => $action) {
//.........这里部分代码省略.........
开发者ID:abcode619,项目名称:wpstuff,代码行数:101,代码来源:wc-template.php

示例11: _woocommercecivicrm_customer_orders

function _woocommercecivicrm_customer_orders($uid)
{
    $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('meta_key' => '_customer_user', 'meta_value' => $uid, 'post_type' => 'shop_order', 'post_status' => array_keys(wc_get_order_statuses()))));
    $site_url = get_site_url();
    $orders = array();
    foreach ($customer_orders as $customer_order) {
        $order = new WC_Order();
        $order->populate($customer_order);
        $status = get_term_by('slug', $order->status, 'shop_order_status');
        //$items = $order->get_items();
        //print_r ($items);
        $item_count = $order->get_item_count();
        $total = $order->get_total();
        $orders[$customer_order->ID]['order_number'] = $order->get_order_number();
        $orders[$customer_order->ID]['order_date'] = date('Y-m-d', strtotime($order->order_date));
        $orders[$customer_order->ID]['order_billing_name'] = $order->get_formatted_billing_full_name();
        $orders[$customer_order->ID]['order_shipping_name'] = $order->get_formatted_shipping_full_name();
        $orders[$customer_order->ID]['item_count'] = $item_count;
        $orders[$customer_order->ID]['order_total'] = $total;
        $orders[$customer_order->ID]['order_link'] = $site_url . "/wp-admin/post.php?action=edit&post=" . $order->get_order_number();
        //$orders['order_total'] = $order->get_order_number();
    }
    return $orders;
}
开发者ID:rajeshrhino,项目名称:uk.co.vedaconsulting.module.woocommercecivicrm,代码行数:24,代码来源:woocommercecivicrm.php

示例12: array

 /**
  * Tracks a checkout
  * @return none
  */
 function track_checkout($order_id, $params)
 {
     $this->user["wc cart size"] = 0;
     $this->user["wc cart value"] = 0;
     if (!is_user_logged_in()) {
         $this->user['name'] = $params["billing_first_name"] . " " . $params["billing_last_name"];
         $this->user['email'] = $params["billing_email"];
         $this->woopra->identify($this->user);
     } else {
         $this->woopra_detect();
     }
     global $woocommerce;
     $cart = $woocommerce->cart;
     $order = new WC_Order($order_id);
     $new_params = array("cart subtotal" => $cart->subtotal, "cart value" => $order->get_total(), "cart size" => $order->get_item_count(), "payment method" => $params["payment_method"], "shipping method" => $order->get_shipping_method(), "order discount" => $order->get_total_discount(), "order number" => $order->get_order_number());
     $this->woopra->track('wc checkout', $new_params, true);
 }
开发者ID:janeczku,项目名称:woopra,代码行数:21,代码来源:frontend.php

示例13: get_api_arguments

 /**
  * @used-by process_payment
  *
  * @param WC_Order $order
  *
  * @return array wc_remote_post 함수에 사용될 파라미터를 담음.
  */
 private function get_api_arguments(WC_Order &$order)
 {
     $item_count = $order->get_item_count();
     if (!$item_count) {
         throw new \LogicException('items are empty!');
     }
     $items = $order->get_items();
     $first_item = reset($items);
     if ($item_count == 1) {
         $goods_name = $first_item['name'];
     } else {
         $fmt = _n('외 %d개 상품', '외 %d개 상품들', $item_count - 1, 'wskl');
         $goods_name = $first_item['name'] . sprintf($fmt, $item_count - 1);
     }
     // from wskl's pay slugs to payapp's pay type
     $idx = array_search($this->checkout_method, array_keys(WSKL_Payment_Gates::get_checkout_methods()));
     $payapp_pay_types = array('card', 'rbank', 'vbank', 'phone');
     $pay_type = $payapp_pay_types[$idx];
     $feedback_url = str_replace('https:', 'http:', add_query_arg('wc-api', 'wskl-payapp-feedback', home_url('/')));
     error_log('Our feedback URL for PayApp: ' . $feedback_url);
     $args = array('sslverify' => FALSE, 'timeout' => 15, 'body' => array('cmd' => 'payrequest', 'userid' => $this->get_option('payapp_user_id'), 'goodname' => html_entity_decode($goods_name), 'price' => $order->order_total, 'recvphone' => preg_replace('/[+\\-\\s]/', '', $order->billing_phone), 'memo' => '', 'reqaddr' => '0', 'feedbackurl' => $feedback_url, 'var1' => $order->id, 'var2' => $order->order_key, 'smsuse' => 'n', 'currency' => 'krw', 'vccode' => '', 'returnurl' => '', 'openpaytype' => $pay_type, 'checkretry' => 'n'));
     return $args;
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:30,代码来源:class-pg-payapp-common.php

示例14: create_xero_invoice

function create_xero_invoice($order_id)
{
    //create Xero Invoice
    $to = 'tim@paratus.com.au';
    $subject = 'Started Xero Invoice Method';
    $message = '';
    wp_mail($to, $subject, $message);
    $data = array();
    $order = new WC_Order($order_id);
    $items = $order->get_items();
    $OrderItemIds = array_keys($items);
    $numberOfItems = $order->get_item_count();
    $data['firstName'] = $order->billing_first_name;
    $data['lastName'] = $order->billing_last_name;
    $data['emailAddress'] = $order->billing_email;
    $data['date'] = "01/01/2014";
    $data['status'] = "DRAFT";
    if (!is_null($order->billing_company)) {
        $data['name'] = $order->billing_company;
    } else {
        $data['name'] = $order->billing_first_name . ' ' . $order->billing_last_name;
    }
    if (!is_null($order->billing_address_1)) {
        $data['streetLevel'] = $order->billing_address_1;
        $data['postLevel'] = $order->billing_address_1;
    } else {
        $data['streetLevel'] = '';
        $data['postLevel'] = '';
    }
    if (!is_null($order->billing_address_2)) {
        $data['streetStreet'] = $order->billing_address_2;
        $data['postStreet'] = $order->billing_address_2;
    } else {
        $data['streetStreet'] = '';
        $data['postStreet'] = '';
    }
    if (!is_null($order->billing_city)) {
        $data['streetSuburb'] = $order->billing_city;
        $data['postSuburb'] = $order->billing_city;
    } else {
        $data['streetSuburb'] = '';
        $data['postSuburb'] = '';
    }
    if (!is_null($order->billing_state)) {
        $data['streetState'] = $order->billing_state;
        $data['postState'] = $order->billing_state;
    } else {
        $data['streetState'] = '';
        $data['postState'] = '';
    }
    if (!is_null($order->billing_postcode)) {
        $data['streetPostcode'] = $order->billing_postcode;
        $data['postPostcode'] = $order->billing_postcode;
    } else {
        $data['streetPostcode'] = '';
        $data['postPostcode'] = '';
    }
    $data['contact'] = array("Name" => $data['name'], "FirstName" => $data['firstName'], "LastName" => $data['lastName'], "EmailAddress" => $data['emailAddress'], "Addresses" => array("Address" => array("AddressType" => "STREET", "AddressLine1" => $data['streetLevel'], "AddressLine2" => $data['streetStreet'], "City" => $data['streetSuburb'], "Region" => $data['streetState'], "PostalCode" => $data['streetPostcode']), "Address" => array("AddressType" => "POBOX", "AddressLine1" => $data['postLevel'], "AddressLine2" => $data['postStreet'], "City" => $data['postSuburb'], "Region" => $data['postState'], "PostalCode" => $data['postPostcode'])));
    $counter = 0;
    $data['submitfile'] = "submit-nsf.php";
    $data['orderServiceType'] = $item['item_meta']['Service Type'][0];
    $data['Reference'] = $order_id;
    foreach ($items as $item) {
        $orderItemId = $OrderItemIds[$counter];
        $product_id = $item['product_id'];
        $product = $order->get_product_from_item($item);
        $product_sku = $product->get_sku();
        $lastTwoLetters = substr($product_sku, -2);
        if ($lastTwoLetters == "ED") {
            $data['orderServiceType'] = "Electronic Delivery";
        } elseif ($lastTwoLetters == "PD") {
            $data['orderServiceType'] = "Paper Delivery";
        } else {
            $data['orderServiceType'] = "Premium Service";
        }
        switch ($product_id) {
            case "1005":
                //NSF
                $description = "Documentation for the establishment of " . $item['item_meta']['fundName'][0];
                $itemCode = 'NSF-' . $lastTwoLetters;
                $taxType = "OUTPUT";
                $itemPrice = $item['line_subtotal'];
                $hasCompany = 0;
                break;
            case "1149":
                //NSFCOY
                $description = "Documentation for the establishment of " . $item['item_meta']['fundName'][0] . " and incorporation of " . $item['item_meta']['companyName'][0] . " " . $item['item_meta']['companySuffix'][0];
                $itemCode = 'NSFCOY-' . $lastTwoLetters;
                $taxType = "OUTPUT";
                $itemPrice = $item['line_subtotal'] - 444;
                $hasCompany = 1;
                break;
            case "1128":
                //COY
                $description = "Documentation for the incorporation of " . $item['item_meta']['companyName'][0] . " " . $item['item_meta']['companySuffix'][0];
                $itemCode = 'COY-' . $lastTwoLetters;
                $taxType = "OUTPUT";
                $itemPrice = $item['line_subtotal'] - 444;
                $hasCompany = 1;
                break;
//.........这里部分代码省略.........
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:101,代码来源:xero-invoice.php


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