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


PHP WC_Order::get_order_number方法代码示例

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


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

示例1: save

 /**
  * Generates and saves the invoice to the uploads folder.
  * @param $dest
  * @return string
  */
 public function save($dest)
 {
     if ($this->exists()) {
         die('Invoice already exists. First delete invoice.');
     }
     // If the invoice is manually deleted from dir, delete data from database.
     $this->delete();
     if ($this->template_options['bewpi_invoice_number_type'] === "sequential_number") {
         if (!$this->reset_counter() && !$this->new_year_reset()) {
             $this->number = $this->template_options['bewpi_last_invoice_number'] + 1;
         }
     } else {
         $this->number = $this->order->get_order_number();
     }
     $this->number_of_columns = $this->get_number_of_columns();
     $this->colspan = $this->get_colspan();
     $this->formatted_number = $this->get_formatted_number(true);
     $this->year = date('Y');
     $this->filename = BEWPI_INVOICES_DIR . (string) $this->year . '/' . $this->formatted_number . '.pdf';
     // Template
     $this->css = $this->get_css();
     $this->header = $this->get_header_html();
     $this->body = $this->get_body_html();
     $this->footer = $this->get_footer_html();
     add_post_meta($this->order->id, '_bewpi_invoice_number', $this->number);
     add_post_meta($this->order->id, '_bewpi_invoice_year', $this->year);
     $this->template_options['bewpi_last_invoice_number'] = $this->number;
     $this->template_options['bewpi_last_invoiced_year'] = $this->year;
     delete_option('bewpi_template_settings');
     add_option('bewpi_template_settings', $this->template_options);
     parent::generate($dest, $this);
     return $this->filename;
 }
开发者ID:siggykun,项目名称:woocommerce-pdf-invoices,代码行数:38,代码来源:bewpi-invoice.php

示例2: get_order_id

 /**
  * Get order ID
  *
  * @see Pronamic_Pay_PaymentDataInterface::get_order_id()
  * @return string
  */
 public function get_order_id()
 {
     // @see https://github.com/woothemes/woocommerce/blob/v1.6.5.2/classes/class-wc-order.php#L269
     $order_id = $this->order->get_order_number();
     /*
      * An '#' charachter can result in the following iDEAL error:
      * code             = SO1000
      * message          = Failure in system
      * detail           = System generating error: issuer
      * consumer_message = Paying with iDEAL is not possible. Please try again later or pay another way.
      *
      * Or in case of Sisow:
      * <errorresponse xmlns="https://www.sisow.nl/Sisow/REST" version="1.0.0">
      *     <error>
      *         <errorcode>TA3230</errorcode>
      *         <errormessage>No purchaseid</errormessage>
      *     </error>
      * </errorresponse>
      *
      * @see http://wcdocs.woothemes.com/user-guide/extensions/functionality/sequential-order-numbers/#add-compatibility
      *
      * @see page 30 http://pronamic.nl/wp-content/uploads/2012/09/iDEAL-Merchant-Integratie-Gids-NL.pdf
      *
      * The use of characters that are not listed above will not lead to a refusal of a batch or post, but the
      * character will be changed by Equens (formerly Interpay) to a space, question mark or asterisk. The
      * same goes for diacritical characters (à, ç, ô, ü, ý etcetera).
      */
     $order_id = str_replace('#', '', $order_id);
     return $order_id;
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:36,代码来源:PaymentData.php

示例3: get_komoju_args

 /**
  * Get Komoju Args for passing to Komoju hosted page
  *
  * @param WC_Order $order
  * @return array
  */
 protected function get_komoju_args($order, $method)
 {
     WC_Gateway_Komoju::log('Generating payment form for order ' . $order->get_order_number() . '. Notify URL: ' . $this->notify_url);
     $params = array("transaction[amount]" => $order->get_subtotal() + $order->get_total_shipping(), "transaction[currency]" => get_woocommerce_currency(), "transaction[customer][email]" => $order->billing_email, "transaction[customer][phone]" => $order->billing_phone, "transaction[customer][given_name]" => $order->billing_first_name, "transaction[customer][family_name]" => $order->billing_last_name, "transaction[external_order_num]" => $this->gateway->get_option('invoice_prefix') . $order->get_order_number() . '-' . $this->request_id, "transaction[return_url]" => $this->gateway->get_return_url($order), "transaction[cancel_url]" => $order->get_cancel_order_url_raw(), "transaction[callback_url]" => $this->notify_url, "transaction[tax]" => strlen($order->get_total_tax()) == 0 ? 0 : $order->get_total_tax(), "timestamp" => time());
     WC_Gateway_Komoju::log('Raw parametres: ' . print_r($params, true));
     $qs_params = array();
     foreach ($params as $key => $val) {
         $qs_params[] = urlencode($key) . '=' . urlencode($val);
     }
     sort($qs_params);
     $query_string = implode('&', $qs_params);
     $url = $this->Komoju_endpoint . $method . '/new' . '?' . $query_string;
     $hmac = hash_hmac('sha256', $url, $this->gateway->secretKey);
     $query_string .= '&hmac=' . $hmac;
     return $query_string;
 }
开发者ID:komoju,项目名称:komoju-woocommerce,代码行数:22,代码来源:class-wc-gateway-komoju-request.php

示例4: createOrder

 /**
  * createOrder
  * --
  * @param $woo_commerce_order_id
  */
 public function createOrder($woo_commerce_order_id)
 {
     // Fetch order from WC.
     $woo_order = new WC_Order($woo_commerce_order_id);
     // Contact Information
     $contact_infomation = $this->buildContactInformation($woo_order->billing_company, $woo_order->billing_first_name . " " . $woo_order->billing_last_name, "WC", $woo_order->billing_phone, $woo_order->shipping_first_name . " " . $woo_order->shipping_last_name, $woo_order->billing_email, "", "");
     // Transaction Information
     $transaction_information = $this->buildTransactionInformation(new DateTime(), new DateTime(), new DateTime(), $woo_order->get_order_number(), $woo_order->get_order_number() . "-" . $woo_order->billing_last_name);
     // Address Information
     $address_information = $this->buildAddressInformation($woo_order->shipping_address_1, $woo_order->shipping_address_2, $woo_order->shipping_city, $woo_order->shipping_state, $woo_order->shipping_country, $woo_order->shipping_postcode);
     // Shipping Instructions
     $shipping_instructions = $this->buildShippingInstructionInformation($woo_order->customer_user, $woo_order->billing_postcode, $this::CARRIER, $this::CARRIER_DESC, $this::CARRIER_MODE, $woo_order->shipping_method_title, $woo_order->customer_note, $woo_order->shipping_postcode, $this::SCAC_CODE);
     // Extraneous Information.
     $shipping_info = null;
     // - not needed in this instance
     $fulfillment_info = null;
     // - not needed in this instance
     // Create new Order for API.
     $order = new Order(1);
     // Ship to, Transaction Info, Customer Notes
     $order->setShipTo($contact_infomation);
     $order->setTransInfo($transaction_information);
     $order->setNotes($woo_order->customer_note);
     // Shipping instructions
     $order->setShippingInstructions($shipping_instructions);
     // Order line item array
     $order_line_item_arr = [];
     // Loop over woo_commerce_order items, and
     // fetch products & product information out of every item.
     foreach ($woo_order->get_items() as $item) {
         // Retrieve product
         $product = $woo_order->get_product_from_item($item);
         // Build new order line item
         $arr_order = $this->buildOrderLineLitem($product->get_sku(), "", $product->get_stock_quantity(), "", $product->get_dimensions(), new DateTime(), $product->sale_price, "", "");
         // Push order line item to [line item arr]
         array_push($order_line_item_arr, $arr_order);
     }
     // Set order line items
     $order->setOrderLineItems($order_line_item_arr);
     // Create an ArrayOfOrder object.
     $aoOrder = new ArrayOfOrder();
     $aoOrder->setOrder([$order]);
     // Execute and return the order action
     return $this->apiHandler->getClient()->CreateOrders($this->apiHandler->getExtLoginData(), $aoOrder);
 }
开发者ID:ThomasCutting,项目名称:3pl-central-integration-plugin,代码行数:50,代码来源:class-api_wrapper.php

示例5: output

    /**
     * Output the shortcode.
     *
     * @access public
     * @param array $atts
     * @return void
     */
    public static function output($atts)
    {
        global $woocommerce;
        $woocommerce->nocache();
        if (!is_user_logged_in()) {
            return;
        }
        extract(shortcode_atts(array('order_count' => 10), $atts));
        $user_id = get_current_user_id();
        $order_id = isset($_GET['order']) ? $_GET['order'] : 0;
        $order = new WC_Order($order_id);
        if ($order_id == 0) {
            woocommerce_get_template('myaccount/my-orders.php', array('order_count' => 'all' == $order_count ? -1 : $order_count));
            return;
        }
        if ($order->user_id != $user_id) {
            echo '<div class="woocommerce-error">' . __('Invalid order.', 'woocommerce') . ' <a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">' . __('My Account &rarr;', 'woocommerce') . '</a>' . '</div>';
            return;
        }
        $status = get_term_by('slug', $order->status, 'shop_order_status');
        echo '<p class="order-info">' . sprintf(__('Order <mark class="order-number">%s</mark> made on <mark class="order-date">%s</mark>', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date))) . '. ' . sprintf(__('Order status: <mark class="order-status">%s</mark>', 'woocommerce'), __($status->name, 'woocommerce')) . '.</p>';
        $notes = $order->get_customer_order_notes();
        if ($notes) {
            ?>
			<h2><?php 
            _e('Order Updates', 'woocommerce');
            ?>
</h2>
			<ol class="commentlist notes">
				<?php 
            foreach ($notes as $note) {
                ?>
				<li class="comment note">
					<div class="comment_container">
						<div class="comment-text">
							<p class="meta"><?php 
                echo date_i18n(__('l jS \\of F Y, h:ia', 'woocommerce'), strtotime($note->comment_date));
                ?>
</p>
							<div class="description">
								<?php 
                echo wpautop(wptexturize($note->comment_content));
                ?>
							</div>
			  				<div class="clear"></div>
			  			</div>
						<div class="clear"></div>
					</div>
				</li>
				<?php 
            }
            ?>
			</ol>
			<?php 
        }
        do_action('woocommerce_view_order', $order_id);
    }
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:64,代码来源:class-wc-shortcode-view-order.php

示例6: process_payment

 public function process_payment($order_id)
 {
     global $woocommerce;
     // Get customer order
     $customer_order = new WC_Order($order_id);
     // Generate URL
     $justgiving_qstr = array('amount' => $customer_order->order_total, 'reference' => woogiving_create_ref($order_id), 'currency' => get_woocommerce_currency(), 'exitUrl' => plugin_dir_url(__FILE__) . 'process.php?wg_action=process&wg_order_id=' . str_replace('#', '', $customer_order->get_order_number()) . '&jg_donation_id=JUSTGIVING-DONATION-ID');
     $justgiving_url = 'https://www.justgiving.com/' . rawurlencode($this->username) . '/4w350m3/donate/?' . http_build_query($justgiving_qstr);
     // Redirect to JustGiving
     return array('result' => 'success', 'redirect' => $justgiving_url);
 }
开发者ID:umarsheikh13,项目名称:woogiving,代码行数:11,代码来源:class.woogiving.php

示例7: wps_wcc_new_order

function wps_wcc_new_order($order_id)
{
    global $sms, $wps_options;
    $order = new WC_Order($order_id);
    if (!$get_mobile) {
        return;
    }
    $sms->to = array(get_option('wp_admin_mobile'));
    $string = $wps_options['wpsms_wc_no_tt'];
    $template_vars = array('order_id' => $order_id, 'status' => $order->get_status(), 'order_name' => $order->get_order_number());
    $final_message = preg_replace('/%(.*?)%/ime', "\$template_vars['\$1']", $string);
    $sms->msg = $final_message;
    $sms->SendSMS();
}
开发者ID:veronalabs,项目名称:wp-sms,代码行数:14,代码来源:index.php

示例8: transparent_checkout_ajax

 /**
  * Saved by ajax the order information.
  */
 public function transparent_checkout_ajax()
 {
     $settings = get_option('woocommerce_moip_settings');
     if ('tc' != $settings['api']) {
         die;
     }
     check_ajax_referer('woocommerce_moip_transparent_checkout', 'security');
     $method = $_POST['method'];
     $order_id = (int) $_POST['order_id'];
     $order = new WC_Order($order_id);
     if (function_exists('WC')) {
         $mailer = WC()->mailer();
     } else {
         global $woocommerce;
         $mailer = $woocommerce->mailer();
     }
     if ('CartaoCredito' == $method) {
         // Add payment information.
         $status = esc_attr(WC_Moip_Messages::translate_status($_POST['status']));
         update_post_meta($order_id, 'woocommerce_moip_method', esc_attr($_POST['method']));
         update_post_meta($order_id, 'woocommerce_moip_code', esc_attr($_POST['code']));
         update_post_meta($order_id, 'woocommerce_moip_status', $status);
         // Send email with payment information.
         $message_body = '<p>';
         $message_body .= WC_Moip_Messages::credit_cart_message($status, $_POST['code']);
         $message_body .= '</p>';
         $message = $mailer->wrap_message(sprintf(__('Order %s received', 'woocommerce-moip'), $order->get_order_number()), apply_filters('woocommerce_moip_thankyou_creditcard_email_message', $message_body, $order_id));
         $mailer->send($order->billing_email, sprintf(__('Order %s received', 'woocommerce-moip'), $order->get_order_number()), $message);
     } else {
         if ('DebitoBancario' == $method) {
             // Add payment information.
             update_post_meta($order_id, 'woocommerce_moip_method', esc_attr($_POST['method']));
             update_post_meta($order_id, 'woocommerce_moip_url', esc_url($_POST['url']));
             // Send email with payment information.
             $url = sprintf('<p><a class="button" href="%1$s" target="_blank">%1$s</a></p>', esc_url($_POST['url']));
             $message_body = '<p>';
             $message_body .= WC_Moip_Messages::debit_email_message();
             $message_body .= '</p>';
             $message = $mailer->wrap_message(sprintf(__('Order %s received', 'woocommerce-moip'), $order->get_order_number()), apply_filters('woocommerce_moip_thankyou_debit_email_message', $message_body, $order_id) . $url);
             $mailer->send($order->billing_email, sprintf(__('Order %s received', 'woocommerce-moip'), $order->get_order_number()), $message);
         } else {
             // Add payment information.
             update_post_meta($order_id, 'woocommerce_moip_method', esc_attr($_POST['method']));
             update_post_meta($order_id, 'woocommerce_moip_url', esc_url($_POST['url']));
             // Send email with payment information.
             $url = sprintf('<p><a class="button" href="%1$s" target="_blank">%1$s</a></p>', esc_url($_POST['url']));
             $message_body = '<p>';
             $message_body .= WC_Moip_Messages::billet_email_message();
             $message_body .= '</p>';
             $message = $mailer->wrap_message(sprintf(__('Order %s received', 'woocommerce-moip'), $order->get_order_number()), apply_filters('woocommerce_moip_thankyou_billet_email_message', $message_body, $order_id) . $url);
             $mailer->send($order->billing_email, sprintf(__('Order %s received', 'woocommerce-moip'), $order->get_order_number()), $message);
         }
     }
     die;
 }
开发者ID:shamps,项目名称:woocommerce-moip,代码行数:58,代码来源:class-wc-moip-ajax.php

示例9: offline_payment_notification

 public function offline_payment_notification($order_id, $customer)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $title = sprintf("Se ha efectuado el pago del pedido %s", $order->get_order_number());
     $body_message = "<p style=\"margin:0 0 16px\">Se ha detectado el pago del siguiente pedido:</p><br />" . $this->assemble_email_payment($order);
     // Email for customer
     $mail_customer = $woocommerce->mailer();
     $message = $mail_customer->wrap_message(sprintf(__('Hola, %s'), $customer), $body_message);
     $mail_customer->send($order->billing_email, $title, $message);
     unset($mail_customer);
     //Email for admin site
     $mail_admin = $woocommerce->mailer();
     $message = $mail_admin->wrap_message(sprintf(__('Pago realizado satisfactoriamente')), $body_message);
     $mail_admin->send(get_option("admin_email"), $title, $message);
     unset($mail_admin);
 }
开发者ID:pcuervo,项目名称:wp-yolcan,代码行数:17,代码来源:conekta_plugin.php

示例10: get_next_invoice_number

 private function get_next_invoice_number()
 {
     // check if user uses the built in WooCommerce order numbers
     if ($this->template_options['bewpi_invoice_number_type'] !== "sequential_number") {
         return $this->order->get_order_number();
     }
     // check if user did a counter reset
     if ($this->template_options['bewpi_reset_counter'] && $this->template_options['bewpi_next_invoice_number'] > 0) {
         $this->counter_reset = true;
         // uncheck option to actually change the value
         $this->template_options['bewpi_reset_counter'] = 0;
         update_option('bewpi_template_settings', $this->template_options);
         return $this->template_options['bewpi_next_invoice_number'];
     }
     $last_invoice_number = $this->get_max_invoice_number();
     return $last_invoice_number == "" ? 1 : (int) $last_invoice_number + 1;
 }
开发者ID:setasss,项目名称:woocommerce-pdf-invoices,代码行数:17,代码来源:abstract-bewpi-invoice.php

示例11: view_order

    /**
     * View order page
     *
     * @param  int $order_id
     */
    private static function view_order($order_id)
    {
        $user_id = get_current_user_id();
        $order = new WC_Order($order_id);
        if (!current_user_can('view_order', $order_id)) {
            echo '<div class="woocommerce-error">' . __('Invalid order.', 'woocommerce') . ' <a href="' . get_permalink(wc_get_page_id('myaccount')) . '" class="wc-forward">' . __('My Account', 'woocommerce') . '</a>' . '</div>';
            return;
        }
        $status = get_term_by('slug', $order->status, 'shop_order_status');
        echo '<p class="order-info">' . sprintf(__('Order <mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date)), __($status->name, 'woocommerce')) . '</p>';
        if ($notes = $order->get_customer_order_notes()) {
            ?>
			<h2><?php 
            _e('Order Updates', 'woocommerce');
            ?>
</h2>
			<ol class="commentlist notes">
				<?php 
            foreach ($notes as $note) {
                ?>
				<li class="comment note">
					<div class="comment_container">
						<div class="comment-text">
							<p class="meta"><?php 
                echo date_i18n(__('l jS \\o\\f F Y, h:ia', 'woocommerce'), strtotime($note->comment_date));
                ?>
</p>
							<div class="description">
								<?php 
                echo wpautop(wptexturize($note->comment_content));
                ?>
							</div>
			  				<div class="clear"></div>
			  			</div>
						<div class="clear"></div>
					</div>
				</li>
				<?php 
            }
            ?>
			</ol>
			<?php 
        }
        do_action('woocommerce_view_order', $order_id);
    }
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:50,代码来源:class-wc-shortcode-my-account.php

示例12: process_subscription_payment

 /**
  * Process the subscription payment and return the result
  *
  * @access      public
  * @param       WC_Order $order
  * @param       int $amount
  * @return      array
  */
 public function process_subscription_payment($order, $amount = 0)
 {
     global $s4wc;
     // Can't send to stripe without a value, assume it's good to go.
     if ($amount === 0) {
         return true;
     }
     // Get customer id
     $customer = get_user_meta($order->user_id, $s4wc->settings['stripe_db_location'], true);
     // Set a default name, override with a product name if it exists for Stripe's dashboard
     $product_name = __('Subscription', 'stripe-for-woocommerce');
     $order_items = $order->get_items();
     // Grab first subscription name and use it
     foreach ($order_items as $key => $item) {
         if (isset($item['subscription_status'])) {
             $product_name = $item['name'];
             break;
         }
     }
     // Default charge description
     $charge_description = sprintf(__('Payment for %s (Order: %s)', 'stripe-for-woocommerce'), $product_name, $order->get_order_number());
     // Allow options to be set without modifying sensitive data like amount, currency, etc.
     $charge_data = apply_filters('s4wc_subscription_charge_data', array(), $order);
     // Set up basics for charging
     $charge_data['amount'] = $amount * 100;
     // amount in cents
     $charge_data['currency'] = strtolower(get_woocommerce_currency());
     $charge_data['customer'] = $customer['customer_id'];
     $charge_data['card'] = $customer['default_card'];
     $charge_data['description'] = apply_filters('s4wc_subscription_charge_description', $charge_description, $order);
     $charge = S4WC_API::create_charge($charge_data);
     if (isset($charge->id)) {
         $order->add_order_note(sprintf(__('Subscription paid (%s)', 'stripe-for-woocommerce'), $charge->id));
         return $charge;
     }
     return false;
 }
开发者ID:rclai,项目名称:stripe-for-woocommerce,代码行数:45,代码来源:class-s4wc_subscriptions_gateway.php

示例13: process_payment

 public function process_payment($order_id)
 {
     global $woocommerce;
     $customer_order = new WC_Order($order_id);
     $environment = $this->environment == "yes" ? 'TRUE' : 'FALSE';
     $environment_url = "FALSE" == $environment ? 'https://secure.authorize.net/gateway/transact.dll' : 'https://test.authorize.net/gateway/transact.dll';
     $payload = array("x_tran_key" => $this->trans_key, "x_login" => $this->api_login, "x_version" => "3.1", "x_amount" => $customer_order->order_total, "x_card_num" => str_replace(array(' ', '-'), '', $_POST['GP_authorize_gateway-card-number']), "x_card_code" => isset($_POST['GP_authorize_gateway-card-cvc']) ? $_POST['GP_authorize_gateway-card-cvc'] : '', "x_exp_date" => str_replace(array('/', ' '), '', $_POST['GP_authorize_gateway-card-expiry']), "x_type" => 'AUTH_CAPTURE', "x_invoice_num" => str_replace("#", "", $customer_order->get_order_number()), "x_test_request" => $environment, "x_delim_char" => '|', "x_encap_char" => '', "x_delim_data" => "TRUE", "x_relay_response" => "FALSE", "x_method" => "CC", "x_first_name" => $customer_order->billing_first_name, "x_last_name" => $customer_order->billing_last_name, "x_address" => $customer_order->billing_address_1, "x_city" => $customer_order->billing_city, "x_state" => $customer_order->billing_state, "x_zip" => $customer_order->billing_postcode, "x_country" => $customer_order->billing_country, "x_phone" => $customer_order->billing_phone, "x_email" => $customer_order->billing_email, "x_ship_to_first_name" => $customer_order->shipping_first_name, "x_ship_to_last_name" => $customer_order->shipping_last_name, "x_ship_to_company" => $customer_order->shipping_company, "x_ship_to_address" => $customer_order->shipping_address_1, "x_ship_to_city" => $customer_order->shipping_city, "x_ship_to_country" => $customer_order->shipping_country, "x_ship_to_state" => $customer_order->shipping_state, "x_ship_to_zip" => $customer_order->shipping_postcode, "x_cust_id" => $customer_order->user_id, "x_customer_ip" => $_SERVER['REMOTE_ADDR']);
     $response = wp_remote_post($environment_url, array('method' => 'POST', 'body' => http_build_query($payload), 'timeout' => 90, 'sslverify' => false));
     if (is_wp_error($response)) {
         do_action('gp_order_online_completed_failed', $response);
     }
     if (empty($response['body'])) {
         do_action('gp_order_online_completed_failed', $response);
     }
     $response_body = wp_remote_retrieve_body($response);
     // Parse the response into something we can read
     foreach (preg_split("/\r?\n/", $response_body) as $line) {
         $resp = explode("|", $line);
     }
     // Get the values we need
     $r['response_code'] = $resp[0];
     $r['response_sub_code'] = $resp[1];
     $r['response_reason_code'] = $resp[2];
     $r['response_reason_text'] = $resp[3];
     if ($r['response_code'] == 1 || $r['response_code'] == 4) {
         $customer_order->add_order_note(__('Authorize.net payment completed.', 'GP_authorize_gateway'));
         if ($this->mark_order == 'yes') {
             $woocommerce->cart->empty_cart();
             $customer_order->payment_complete();
             $customer_order->update_status('completed');
         }
         do_action('gp_order_online_completed_successfully', $response);
         return array('result' => 'success', 'redirect' => $this->get_return_url($customer_order));
     } else {
         do_action('gp_error_occurred', $r['response_reason_text']);
     }
 }
开发者ID:GammaPartners,项目名称:WooCommerce-Payment-Gateways,代码行数:37,代码来源:authorizenet.php

示例14: get_hosted_payments_args

 /**
  * Hosted payment args.
  *
  * @param  WC_Order $order
  *
  * @return array
  */
 protected function get_hosted_payments_args($order)
 {
     $args = apply_filters('woocommerce_simplify_commerce_hosted_args', array('sc-key' => $this->public_key, 'amount' => $order->get_total() * 100, 'reference' => $order->get_id(), 'name' => esc_html(get_bloginfo('name', 'display')), 'description' => sprintf(__('Order #%s', 'woocommerce'), $order->get_order_number()), 'receipt' => 'false', 'color' => $this->modal_color, 'redirect-url' => WC()->api_request_url('WC_Gateway_Simplify_Commerce'), 'address' => $order->get_billing_address_1() . ' ' . $order->get_billing_address_2(), 'address-city' => $order->get_billing_city(), 'address-state' => $order->get_billing_state(), 'address-zip' => $order->get_billing_postcode(), 'address-country' => $order->get_billing_country(), 'operation' => 'create.token'), $order->get_id());
     return $args;
 }
开发者ID:nishitlangaliya,项目名称:woocommerce,代码行数:12,代码来源:class-wc-gateway-simplify-commerce.php

示例15: woocommerce_ecommerce_tracking_piwik

/**
 * ecommerce tracking with piwik.
 *
 * @access public
 * @param int $order_id
 * @return void
 */
function woocommerce_ecommerce_tracking_piwik($order_id)
{
    global $woocommerce;
    // Don't track admin
    if (current_user_can('manage_options')) {
        return;
    }
    // Call the Piwik ecommerce function if WP-Piwik is configured to add tracking codes to the page
    $wp_piwik_global_settings = get_option('wp-piwik_global-settings');
    // Return if Piwik settings are not here, or if global is not set
    if (!isset($wp_piwik_global_settings['add_tracking_code']) || !$wp_piwik_global_settings['add_tracking_code']) {
        return;
    }
    if (!isset($GLOBALS['wp_piwik'])) {
        return;
    }
    // Get the order and get tracking code
    $order = new WC_Order($order_id);
    ob_start();
    ?>
	try {
		// Add order items
		<?php 
    if ($order->get_items()) {
        foreach ($order->get_items() as $item) {
            $_product = $order->get_product_from_item($item);
            ?>

			piwikTracker.addEcommerceItem(
				"<?php 
            echo esc_js($_product->get_sku());
            ?>
",			// (required) SKU: Product unique identifier
				"<?php 
            echo esc_js($item['name']);
            ?>
",					// (optional) Product name
				"<?php 
            if (isset($_product->variation_data)) {
                echo esc_js(woocommerce_get_formatted_variation($_product->variation_data, true));
            }
            ?>
",	// (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
				<?php 
            echo esc_js($order->get_item_total($item));
            ?>
,	// (recommended) Product price
				<?php 
            echo esc_js($item['qty']);
            ?>
 						// (optional, default to 1) Product quantity
			);

		<?php 
        }
    }
    ?>

		// Track order
		piwikTracker.trackEcommerceOrder(
			"<?php 
    echo esc_js($order->get_order_number());
    ?>
",	// (required) Unique Order ID
			<?php 
    echo esc_js($order->get_total());
    ?>
,			// (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
			false,													// (optional) Order sub total (excludes shipping)
			<?php 
    echo esc_js($order->get_total_tax());
    ?>
,		// (optional) Tax amount
			<?php 
    echo esc_js($order->get_shipping());
    ?>
,		// (optional) Shipping amount
			false 													// (optional) Discount offered (set to false for unspecified parameter)
		);
	} catch( err ) {}
	<?php 
    $code = ob_get_clean();
    $woocommerce->add_inline_js($code);
}
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:91,代码来源:woocommerce-functions.php


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