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


PHP WC_Order::get_order_item_totals方法代码示例

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


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

示例1: foreach

_e('Product', 'woocommerce');
?>
</th>
			<th class="product-quantity"><?php 
_e('Qty', 'woocommerce');
?>
</th>
			<th class="product-total"><?php 
_e('Totals', 'woocommerce');
?>
</th>
		</tr>
	</thead>
	<tfoot>
	<?php 
if ($totals = $order->get_order_item_totals()) {
    foreach ($totals as $label => $value) {
        ?>
			<tr>
				<th scope="row" colspan="2"><?php 
        echo $label;
        ?>
</th>
				<td><?php 
        echo $value;
        ?>
</td>
			</tr>
			<?php 
    }
}
开发者ID:rosslavery,项目名称:woocommerce,代码行数:31,代码来源:order-details.php

示例2:

global $woocommerce;

$order = new WC_Order( $order_id );
?>
<h5><?php _e('Order Details', 'woocommerce'); ?></h5>
<table class="shop_table order_details table table-bordered table-striped">
	<thead>
		<tr>
			<th class="product-name"><?php _e('Product', 'woocommerce'); ?></th>
			<th class="product-quantity"><?php _e('Qty', 'woocommerce'); ?></th>
			<th class="product-total"><?php _e('Totals', 'woocommerce'); ?></th>
		</tr>
	</thead>
	<tfoot>
	<?php
		if ( $totals = $order->get_order_item_totals() ) foreach ( $totals as $total ) :
			?>
			<tr>
				<th scope="row" colspan="2"><?php echo $total['label']; ?></th>
				<td><?php echo $total['value']; ?></td>
			</tr>
			<?php
		endforeach;
	?>
	</tfoot>
	<tbody>
		<?php
		if (sizeof($order->get_items())>0) :

			foreach($order->get_items() as $item) :
开发者ID:phanhoanglong2610,项目名称:flowershop,代码行数:30,代码来源:order-details.php

示例3: access_woocommerce_view_order

function access_woocommerce_view_order($order_id)
{
    global $woocommerce;
    $order = new WC_Order($order_id);
    ?>
    <div class="avada-order-details woocommerce-content-box full-width">
        <h2><?php 
    _e('Order Details', 'woocommerce');
    ?>
</h2>
        <table class="shop_table order_details">
            <thead>
            <tr>
                <th class="product-name"><?php 
    _e('Product', 'woocommerce');
    ?>
</th>
                <th class="product-quantity"><?php 
    _e('Quantity', 'woocommerce');
    ?>
</th>
                <th class="product-total"><?php 
    _e('Total', 'woocommerce');
    ?>
</th>
            </tr>
            </thead>
            <tfoot>
            <?php 
    if ($totals = $order->get_order_item_totals()) {
        foreach ($totals as $total) {
            ?>
                        <tr>
                            <td class="filler-td">&nbsp;</td>
                            <th scope="row"><?php 
            echo $total['label'];
            ?>
</th>
                            <td class="product-total"><?php 
            echo $total['value'];
            ?>
</td>
                        </tr>
                    <?php 
        }
    }
    ?>
            </tfoot>
            <tbody>
            <?php 
    if (sizeof($order->get_items()) > 0) {
        foreach ($order->get_items() as $item) {
            $_product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item);
            $item_meta = new WC_Order_Item_Meta($item['item_meta']);
            ?>
                        <tr class="<?php 
            echo esc_attr(apply_filters('woocommerce_order_item_class', 'order_item', $item, $order));
            ?>
">
                            <td class="product-name">
                        <span class="product-thumbnail">
                            <?php 
            $thumbnail = apply_filters('woocommerce_cart_item_thumbnail', $_product->get_image());
            if (!$_product->is_visible()) {
                echo $thumbnail;
            } else {
                printf('<a href="%s">%s</a>', $_product->get_permalink(), $thumbnail);
            }
            ?>
                        </span>

                                <div class="product-info">
                                    <?php 
            if ($_product && !$_product->is_visible()) {
                echo apply_filters('woocommerce_order_item_name', $item['name'], $item);
            } else {
                echo apply_filters('woocommerce_order_item_name', sprintf('<a href="%s">%s</a>', get_permalink($item['product_id']), $item['name']), $item);
            }
            $item_meta->display();
            if ($_product && $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted()) {
                $download_files = $order->get_item_downloads($item);
                $i = 0;
                $links = array();
                foreach ($download_files as $download_id => $file) {
                    $i++;
                    $links[] = '<small><a href="' . esc_url($file['download_url']) . '">' . sprintf(__('Download file%s', 'woocommerce'), count($download_files) > 1 ? ' ' . $i . ': ' : ': ') . esc_html($file['name']) . '</a></small>';
                }
                echo '<br/>' . implode('<br/>', $links);
            }
            ?>
                                </div>
                            </td>
                            <td class="product-quantity">
                                <?php 
            echo apply_filters('woocommerce_order_item_quantity_html', $item['qty'], $item);
            ?>
                            </td>
                            <td class="product-total">
                                <?php 
            echo $order->get_formatted_line_subtotal($item);
//.........这里部分代码省略.........
开发者ID:baden03,项目名称:access48,代码行数:101,代码来源:functions.php

示例4: ConfirmPayment

 /**
  * ConfirmPayment
  *
  * Finalizes the checkout with PayPal's DoExpressCheckoutPayment API
  *
  * @FinalPaymentAmt (double) Final payment amount for the order.
  */
 function ConfirmPayment($FinalPaymentAmt)
 {
     /*
      * Display message to user if session has expired.
      */
     if (sizeof(WC()->cart->get_cart()) == 0) {
         $ms = sprintf(__('Sorry, your session has expired. <a href=%s>Return to homepage &rarr;</a>', 'paypal-for-woocommerce'), '"' . home_url() . '"');
         $ec_confirm_message = apply_filters('angelleye_ec_confirm_message', $ms);
         wc_add_notice($ec_confirm_message, "error");
     }
     /*
      * Check if the PayPal class has already been established.
      */
     if (!class_exists('Angelleye_PayPal')) {
         require_once 'lib/angelleye/paypal-php-library/includes/paypal.class.php';
     }
     /*
      * Create PayPal object.
      */
     $PayPalConfig = array('Sandbox' => $this->testmode == 'yes' ? TRUE : FALSE, 'APIUsername' => $this->api_username, 'APIPassword' => $this->api_password, 'APISignature' => $this->api_signature);
     $PayPal = new Angelleye_PayPal($PayPalConfig);
     /*
      * Get data from WooCommerce object
      */
     if (!empty($this->confirm_order_id)) {
         $order = new WC_Order($this->confirm_order_id);
         $invoice_number = preg_replace("/[^0-9]/", "", $order->get_order_number());
         if ($order->customer_note) {
             $customer_notes = wptexturize($order->customer_note);
         }
         $shipping_first_name = $order->shipping_first_name;
         $shipping_last_name = $order->shipping_last_name;
         $shipping_address_1 = $order->shipping_address_1;
         $shipping_address_2 = $order->shipping_address_2;
         $shipping_city = $order->shipping_city;
         $shipping_state = $order->shipping_state;
         $shipping_postcode = $order->shipping_postcode;
         $shipping_country = $order->shipping_country;
     }
     // Prepare request arrays
     $DECPFields = array('token' => urlencode($this->get_session('TOKEN')), 'payerid' => urlencode($this->get_session('payer_id')), 'returnfmfdetails' => '', 'giftmessage' => $this->get_session('giftmessage'), 'giftreceiptenable' => $this->get_session('giftreceiptenable'), 'giftwrapname' => $this->get_session('giftwrapname'), 'giftwrapamount' => $this->get_session('giftwrapamount'), 'buyermarketingemail' => '', 'surveyquestion' => '', 'surveychoiceselected' => '', 'allowedpaymentmethod' => '');
     $Payments = array();
     $order_items_own = array();
     $final_order_total = $order->get_order_item_totals();
     $current_currency = get_woocommerce_currency_symbol(get_woocommerce_currency());
     $final_order_total_amt_strip_ec = strip_tags($final_order_total['order_total']['value']);
     $final_order_total_amt_strip = str_replace(',', '', $final_order_total_amt_strip_ec);
     $final_order_total_amt = str_replace($current_currency, '', $final_order_total_amt_strip);
     $Payment = array('amt' => number_format($final_order_total_amt, 2, '.', ''), 'currencycode' => get_woocommerce_currency(), 'shippingdiscamt' => '', 'insuranceoptionoffered' => '', 'handlingamt' => '', 'desc' => '', 'custom' => '', 'invnum' => preg_replace("/[^0-9]/", "", $this->confirm_order_id), 'notifyurl' => '', 'shiptoname' => $shipping_first_name . ' ' . $shipping_last_name, 'shiptostreet' => $shipping_address_1, 'shiptostreet2' => $shipping_address_2, 'shiptocity' => $shipping_city, 'shiptostate' => $shipping_state, 'shiptozip' => $shipping_postcode, 'shiptocountrycode' => $shipping_country, 'shiptophonenum' => '', 'notetext' => $this->get_session('customer_notes'), 'allowedpaymentmethod' => '', 'paymentaction' => $this->payment_action == 'Authorization' ? 'Authorization' : 'Sale', 'paymentrequestid' => '', 'sellerpaypalaccountid' => '', 'sellerid' => '', 'sellerusername' => '', 'sellerregistrationdate' => '', 'softdescriptor' => '');
     $PaymentOrderItems = array();
     $ctr = $total_items = $total_discount = $total_tax = $shipping = 0;
     $ITEMAMT = 0;
     $counter = 1;
     if (sizeof($order->get_items()) > 0) {
         //   if ($this->send_items) {
         foreach ($order->get_items() as $values) {
             $_product = $order->get_product_from_item($values);
             $qty = absint($values['qty']);
             $sku = $_product->get_sku();
             $values['name'] = html_entity_decode($values['name'], ENT_NOQUOTES, 'UTF-8');
             if ($_product->product_type == 'variation') {
                 if (empty($sku)) {
                     $sku = $_product->parent->get_sku();
                 }
                 //$item_meta = new WC_Order_Item_Meta($values['item_meta']);
                 $item_meta = new WC_Order_Item_Meta($values, $_product);
                 $meta = $item_meta->display(true, true);
                 if (!empty($meta)) {
                     $values['name'] .= " - " . str_replace(", \n", " - ", $meta);
                 }
             }
             //////////////////////////////////////////***************************////////////////////////////////////
             $lineitems_prepare = $this->prepare_line_items($order);
             $lineitems = $_SESSION['line_item'];
             if (in_array($values['product_id'], $lineitems)) {
                 $arraykey = array_search($values['product_id'], $lineitems);
                 $item_position = str_replace('product_number_', '', $arraykey);
                 $get_amountkey = 'amount_' . $counter;
                 $get_qtykey = 'quantity_' . $counter;
                 $switcher_amt = $lineitems[$get_amountkey];
                 $switcher_qty = $lineitems[$get_qtykey];
                 $counter = $counter + 1;
             }
             //////////////////////////////////////////***************************////////////////////////////////////
             $Item = array('name' => $values['name'], 'desc' => '', 'amt' => round($switcher_amt, 2), 'number' => $sku, 'qty' => $qty, 'taxamt' => '', 'itemurl' => '', 'itemcategory' => '', 'itemweightvalue' => '', 'itemweightunit' => '', 'itemheightvalue' => '', 'itemheightunit' => '', 'itemwidthvalue' => '', 'itemwidthunit' => '', 'itemlengthvalue' => '', 'itemlengthunit' => '', 'ebayitemnumber' => '', 'ebayitemauctiontxnid' => '', 'ebayitemorderid' => '', 'ebayitemcartid' => '');
             array_push($PaymentOrderItems, $Item);
             $ITEMAMT += round($switcher_amt, 2) * $switcher_qty;
             $order_items_own[] = round($switcher_amt, 2) * $switcher_qty;
         }
         /**
          * Add custom Woo cart fees as line items
          */
         foreach (WC()->cart->get_fees() as $fee) {
//.........这里部分代码省略.........
开发者ID:ujam-dev,项目名称:paypal-woocommerce,代码行数:101,代码来源:wc-gateway-paypal-express-angelleye.php

示例5: orderpost

function orderpost($orderId)
{
    global $wpdb;
    $testMode = get_option('linksync_test');
    $LAIDKey = get_option('linksync_laid');
    $apicall = new linksync_class($LAIDKey, $testMode);
    //Checking for already sent Order
    $sentOrderIds = get_option('linksync_sent_order_id');
    if (isset($sentOrderIds)) {
        if (!empty($sentOrderIds)) {
            $order_id_array = unserialize($sentOrderIds);
        } else {
            $order_id_array = array();
        }
        if (!in_array($orderId, $order_id_array)) {
            $order = new WC_Order($orderId);
            if ($order->post_status == get_option('order_status_wc_to_vend')) {
                update_option('linksync_sent_order_id', serialize(array_merge($order_id_array, array($orderId))));
                $order_no = $order->get_order_number();
                if (strpos($order_no, '#') !== false) {
                    $order_no = str_replace('#', '', $order_no);
                }
                $get_total = $order->get_total();
                $get_user = $order->get_user();
                $comments = $order->post->post_excerpt;
                $primary_email_address = $get_user->data->user_email;
                $currency = $order->get_order_currency();
                $shipping_method = $order->get_shipping_method();
                $order_total = $order->get_order_item_totals();
                $transaction_id = $order->get_transaction_id();
                $taxes_included = false;
                $total_discount = $order->get_total_discount();
                $total_quantity = 0;
                $registerDb = get_option('wc_to_vend_register');
                $vend_uid = get_option('wc_to_vend_user');
                $total_tax = $order->get_total_tax();
                // Geting Payment object details
                if (isset($order_total['payment_method']['value']) && !empty($order_total['payment_method']['value'])) {
                    $wc_payment = get_option('wc_to_vend_payment');
                    if (isset($wc_payment) && !empty($wc_payment)) {
                        $total_payments = explode(",", $wc_payment);
                        foreach ($total_payments as $mapped_payment) {
                            $exploded_mapped_payment = explode("|", $mapped_payment);
                            if (isset($exploded_mapped_payment[1]) && !empty($exploded_mapped_payment[1]) && isset($exploded_mapped_payment[0]) && !empty($exploded_mapped_payment[0])) {
                                if ($exploded_mapped_payment[1] == $order_total['payment_method']['value']) {
                                    $vend_payment_data = explode("%%", $exploded_mapped_payment[0]);
                                    if (isset($vend_payment_data[0])) {
                                        $payment_method = $vend_payment_data[0];
                                    }
                                    if (isset($vend_payment_data[1])) {
                                        $payment_method_id = $vend_payment_data[1];
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    $payment = array("retailer_payment_type_id" => isset($payment_method_id) ? $payment_method_id : null, "amount" => isset($get_total) ? $get_total : 0, "method" => isset($payment_method) ? $payment_method : null, "transactionNumber" => isset($transaction_id) ? $transaction_id : null);
                }
                $export_user_details = get_option('wc_to_vend_export');
                if (isset($export_user_details) && !empty($export_user_details)) {
                    if ($export_user_details == 'customer') {
                        //woocommerce filter
                        $billingAddress_filter = apply_filters('woocommerce_order_formatted_billing_address', array('firstName' => $order->billing_first_name, 'lastName' => $order->billing_last_name, 'phone' => $order->billing_phone, 'street1' => $order->billing_address_1, 'street2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'postalCode' => $order->billing_postcode, 'country' => $order->billing_country, 'company' => $order->billing_company, 'email_address' => $order->billing_email), $order);
                        $billingAddress = array('firstName' => $billingAddress_filter['firstName'], 'lastName' => $billingAddress_filter['lastName'], 'phone' => $billingAddress_filter['phone'], 'street1' => $billingAddress_filter['street1'], 'street2' => $billingAddress_filter['street2'], 'city' => $billingAddress_filter['city'], 'state' => $billingAddress_filter['state'], 'postalCode' => $billingAddress_filter['postalCode'], 'country' => $billingAddress_filter['country'], 'company' => $billingAddress_filter['company'], 'email_address' => $billingAddress_filter['email_address']);
                        $deliveryAddress_filter = apply_filters('woocommerce_order_formatted_shipping_address', array('firstName' => $order->shipping_first_name, 'lastName' => $order->shipping_last_name, 'phone' => $order->shipping_phone, 'street1' => $order->shipping_address_1, 'street2' => $order->shipping_address_2, 'city' => $order->shipping_city, 'state' => $order->shipping_state, 'postalCode' => $order->shipping_postcode, 'country' => $order->shipping_country, 'company' => $order->shipping_company), $order);
                        $deliveryAddress = array('firstName' => $deliveryAddress_filter['firstName'], 'lastName' => $deliveryAddress_filter['lastName'], 'phone' => $deliveryAddress_filter['phone'], 'street1' => $deliveryAddress_filter['street1'], 'street2' => $deliveryAddress_filter['street2'], 'city' => $deliveryAddress_filter['city'], 'state' => $deliveryAddress_filter['state'], 'postalCode' => $deliveryAddress_filter['postalCode'], 'country' => $deliveryAddress_filter['country'], 'company' => $deliveryAddress_filter['company']);
                        $primary_email = isset($primary_email_address) ? $primary_email_address : $billingAddress['email_address'];
                        unset($billingAddress['email_address']);
                    }
                }
                $vend_user_detail = get_option('wc_to_vend_user');
                if (isset($vend_user_detail) && !empty($vend_user_detail)) {
                    $user = explode('|', $vend_user_detail);
                    $vend_uid = isset($user[0]) ? $user[0] : null;
                    $vend_username = isset($user[1]) ? $user[1] : null;
                }
                //Ordered product(s)
                $items = $order->get_items();
                $taxes = $order->get_taxes();
                foreach ($items as $item) {
                    foreach ($taxes as $tax_label) {
                        $sql = mysql_query("SELECT  tax_rate_id FROM  `" . $wpdb->prefix . "woocommerce_tax_rates` WHERE  tax_rate_name='" . $tax_label['label'] . "' AND tax_rate_class='" . $item['item_meta']['_tax_class'][0] . "'");
                        if (mysql_num_rows($sql) != 0) {
                            $tax_classes = linksync_tax_classes($tax_label['label'], $item['item_meta']['_tax_class'][0]);
                            if ($tax_classes['result'] == 'success') {
                                $vend_taxes = explode('/', $tax_classes['tax_classes']);
                            }
                        }
                    }
                    $taxId = isset($vend_taxes[0]) ? $vend_taxes[0] : null;
                    $taxName = isset($vend_taxes[1]) ? $vend_taxes[1] : null;
                    $taxRate = isset($vend_taxes[2]) ? $vend_taxes[2] : null;
                    if (isset($item['variation_id']) && !empty($item['variation_id'])) {
                        $product_id = $item['variation_id'];
                    } else {
                        $product_id = $item['product_id'];
                    }
                    $pro_object = new WC_Product($product_id);
                    $itemtotal = (double) $item['item_meta']['_line_subtotal'][0];
//.........这里部分代码省略.........
开发者ID:amanpreet8333,项目名称:linksync,代码行数:101,代码来源:linksync_add_action_order.php

示例6: fp_rac_mail_admin_cart_recovered

    public static function fp_rac_mail_admin_cart_recovered($order_id)
    {
        if (get_option('rac_admin_cart_recovered_noti') == "yes") {
            $to = get_option('rac_admin_email');
            $subject = get_option('rac_recovered_email_subject');
            $message = get_option('rac_recovered_email_message');
            $headers = "MIME-Version: 1.0\r\n";
            $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
            if (get_option('rac_recovered_sender_opt') == "woo") {
                $headers .= FPRacCron::rac_formatted_from_address_woocommerce();
                $headers .= "Reply-To: " . get_option('woocommerce_email_from_name') . " <" . get_option('woocommerce_email_from_address') . ">\r\n";
            } else {
                $headers .= FPRacCron::rac_formatted_from_address_local(get_option('rac_recovered_from_name'), get_option('rac_recovered_from_email'));
                $headers .= "Reply-To: " . get_option('rac_recovered_from_name') . " <" . get_option('rac_recovered_from_email') . ">\r\n";
            }
            $message = str_replace('{rac.recovered_order_id}', $order_id, $message);
            //replacing shortcode for order id
            ob_start();
            $order = new WC_Order($order_id);
            ?>

            <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
                <thead>
                    <tr>
                        <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
            _e('Product', 'woocommerce');
            ?>
</th>
                        <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
            _e('Quantity', 'woocommerce');
            ?>
</th>
                        <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
            _e('Price', 'woocommerce');
            ?>
</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
            echo $order->email_order_items_table(false, true);
            ?>

                </tbody>
                <tfoot>
                    <?php 
            if ($totals = $order->get_order_item_totals()) {
                $i = 0;
                foreach ($totals as $total) {
                    $i++;
                    ?>
<tr>
                                <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php 
                    if ($i == 1) {
                        echo 'border-top-width: 4px;';
                    }
                    ?>
"><?php 
                    echo $total['label'];
                    ?>
</th>
                                <td style="text-align:left; border: 1px solid #eee; <?php 
                    if ($i == 1) {
                        echo 'border-top-width: 4px;';
                    }
                    ?>
"><?php 
                    echo $total['value'];
                    ?>
</td>
                            </tr><?php 
                }
            }
            ?>

                </tfoot>
            </table>

            <?php 
            $newdata = ob_get_clean();
            ob_start();
            $message = str_replace('{rac.order_line_items}', $newdata, $message);
            if (function_exists('wc_get_template')) {
                wc_get_template('emails/email-header.php', array('email_heading' => $subject));
                echo $message;
                wc_get_template('emails/email-footer.php');
            } else {
                woocommerce_get_template('emails/email-header.php', array('email_heading' => $subject));
                echo $message;
                woocommerce_get_template('emails/email-footer.php');
            }
            $woo_temp_msg = ob_get_clean();
            if ('wp_mail' == get_option('rac_trouble_mail')) {
                FPRacCron::rac_send_wp_mail($to, $subject, $woo_temp_msg, $headers);
            } else {
                FPRacCron::rac_send_mail($to, $subject, $woo_temp_msg, $headers);
            }
        }
    }
开发者ID:bear12345678,项目名称:keylessoption,代码行数:99,代码来源:recoverabandoncart.php


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