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


PHP WC_Order::update_status方法代码示例

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


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

示例1: intval

 /**
  * Update a order status
  *
  * @return void
  */
 function change_order_status()
 {
     check_ajax_referer('dokan_change_status');
     $order_id = intval($_POST['order_id']);
     $order_status = $_POST['order_status'];
     $order = new WC_Order($order_id);
     $order->update_status($order_status);
     $statuses = wc_get_order_statuses();
     $status_label = isset($statuses[$order_status]) ? $statuses[$order_status] : $order_status;
     $status_class = dokan_get_order_status_class($order_status);
     echo '<label class="dokan-label dokan-label-' . $status_class . '">' . $status_label . '</label>';
     exit;
 }
开发者ID:nuwe1,项目名称:dokan-lite,代码行数:18,代码来源:ajax.php

示例2: update_order_detail

 public function update_order_detail($order_id, $data)
 {
     global $wpdb, $woocommerce, $pwa;
     $non_received = $wpdb->get_results("select * from {$wpdb->postmeta} where meta_key = '_non_received' and post_id = {$order_id} ");
     if (empty($non_received)) {
         $pwacheckkout = new Pwacheckout();
         if ($pwacheckkout->get_option('iopn_dump') == 'yes') {
             $dir = $pwacheckkout->get_option('iopn_dump_url');
             if (!file_exists($dir) && !is_dir($dir)) {
                 mkdir($dir, 0777);
             }
             $filename = $dir . $order_id . '_iopn_non';
             $myfile = fopen($filename, "w");
             fwrite($myfile, $data);
             fclose($myfile);
         }
         add_post_meta($order_id, '_non_received', '1');
         if (UPDATE_ODER_FROM == 'xmlcart') {
             $this->update_cart_by_xml($order_id, $data);
         } else {
             $this->update_cart_by_woocart($order_id, $data);
         }
     }
     $order = new WC_Order($order_id);
     $order->update_status('cancelled');
     // Acknowledge the order in seller central using MWS FEED API
     $pwa->pwa_cancel_feed($order_id);
     header('HTTP/1.1 200 OK');
     exit;
 }
开发者ID:booklein,项目名称:wpbookle,代码行数:30,代码来源:OrderCancelledNotification.php

示例3: custom_woocommerce_auto_complete_order

function custom_woocommerce_auto_complete_order( $order_id ) {
	global $woocommerce;

	if ( !$order_id )
		return;
	$order = new WC_Order( $order_id );
	$order->update_status( 'completed' );
}
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:8,代码来源:functions.php

示例4: jabulani

 public function jabulani($order_id)
 {
     $order = new WC_Order($order_id);
     $j = get_post_meta($order_id, '_payment_method');
     if ($j[0] == 'pagseguro') {
         if ($order->status == 'pending') {
             $order->update_status('on-hold');
         }
     }
 }
开发者ID:TiagoSilvestre,项目名称:PluginParaBaixarEstoqueNoPedido,代码行数:10,代码来源:woocommerce-reduces-inventory-in-order.php

示例5: process_payment

 public function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $order->update_status('pending');
     // Reduce stock levels
     $order->reduce_order_stock();
     // Remove cart
     $woocommerce->cart->empty_cart();
     return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id')))));
 }
开发者ID:bonini81,项目名称:bitpagos-woocommerce,代码行数:11,代码来源:index.php

示例6: completeOrder

 /**
  * Complete a WooCommerce order
  */
 public function completeOrder(WC_Order $order, $payment_hash)
 {
     $status = PayPro_WC_Plugin::$settings->paymentCompleteStatus();
     if (empty($status)) {
         $status = 'wc-processing';
     }
     $order->update_status($status, sprintf(__('PayPro payment succeeded (%s)', 'paypro-gateways-woocommerce'), $payment_hash));
     $order->reduce_order_stock();
     $order->payment_complete();
     $this->removeOrderPaymentHashes($order->id);
 }
开发者ID:paypronl,项目名称:woocommerce-payments-plugin,代码行数:14,代码来源:woocommerce.php

示例7: process_payment

 /**
  * Process the payment and return the result
  *
  * @param int $order_id
  * @return array
  */
 public function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     // Mark as on-hold (we're awaiting the cheque)
     $order->update_status('on-hold', __('Awaiting cheque payment', 'woocommerce'));
     // Reduce stock levels
     $order->reduce_order_stock();
     // Remove cart
     WC()->cart->empty_cart();
     // Return thankyou redirect
     return array('result' => 'success', 'redirect' => $this->get_return_url($order));
 }
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:18,代码来源:class-wc-gateway-cheque.php

示例8: handle_request

 public function handle_request($url, $args, $parameters, $order_id, $item_id)
 {
     // multipart request
     try {
         $args = $this->create_multipart_request($parameters, $args);
         $links = $this->do_request($url, $args);
         $this->add_downloadlinks($links, $item_id);
     } catch (Exception $e) {
         $order = new WC_Order($order_id);
         $order->update_status('wc-booxtream-error', $e->getMessage());
     }
 }
开发者ID:BooXtream,项目名称:BooXtream-WooCommerce,代码行数:12,代码来源:class-wc-booxtream-request.php

示例9: updateStatus

 public function updateStatus($to, $desc)
 {
     // $order = new \WC_Order( $this->_actual_model_id );
     // $order->update_status( $to );
     // Right now, we don't want the overhead of the WooCom
     // events that are triggered with a status update.
     Helpers::debug("Order::updateStatus to " . var_export($to, true));
     $order = new \WC_Order($this->_actual_model_id);
     Helpers::debug("Using WOOCOM to update status");
     $order->update_status($to);
     //$this->updateTerm('status','shop_order_status',$to);
 }
开发者ID:borisdiakur,项目名称:woocommerce-json-api,代码行数:12,代码来源:Order.php

示例10: wpuw_custom_woocommerce_auto_complete_order

function wpuw_custom_woocommerce_auto_complete_order($order_id)
{
    if (!$order_id) {
        return;
    }
    $order = new WC_Order($order_id);
    if (count($order->get_items()) > 0) {
        foreach ($order->get_items() as $item) {
            if (has_term('credit', 'product_cat', $item['product_id'])) {
                $order->update_status('completed');
            }
        }
    }
}
开发者ID:justingreerbbi,项目名称:user-waller-credit-system,代码行数:14,代码来源:functions.php

示例11: unset

 /**
  * Process the payment and return the result
  *
  * @access public
  * @param int $order_id
  * @return array
  */
 function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     // Mark as on-hold (we're awaiting the cheque)
     $order->update_status('on-hold', __('Payment to be made upon delivery.', 'woocommerce'));
     // Reduce stock levels
     $order->reduce_order_stock();
     // Remove cart
     $woocommerce->cart->empty_cart();
     // Empty awaiting payment session
     unset($_SESSION['order_awaiting_payment']);
     // Return thankyou redirect
     return array('result' => 'success', 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks')))));
 }
开发者ID:vjdesign,项目名称:fontaine,代码行数:22,代码来源:class-wc-cod.php

示例12: explode

 function successful_request($posted)
 {
     //print_r($posted);
     global $woocommerce;
     $order_id_key = $posted['customerReference'];
     $order_id_key = explode("-", $order_id_key);
     $order_id = $order_id_key[0];
     $order_key = $order_id_key[1];
     $responseCode = $posted['responseCode'];
     $responseText = $posted['responseText'];
     $txnreference = $posted['txnreference'];
     $order = new WC_Order($order_id);
     if ($order->order_key !== $order_key) {
         echo 'Error: Order Key does not match invoice.';
         exit;
     }
     if ($order->get_total() != $posted['amount']) {
         echo 'Error: Amount not match.';
         $order->update_status('on-hold', sprintf(__('Validation error: BrainTree amounts do not match (%s).', 'woocommerce'), $posted['amount']));
         exit;
     }
     // if TXN is approved
     if ($responseCode == "00" || $responseCode == "08" || $responseCode == "77") {
         // Payment completed
         $order->add_order_note(__('payment completed', 'woocommerce'));
         // Mark order complete
         $order->payment_complete();
         // Empty cart and clear session
         $woocommerce->cart->empty_cart();
         // Redirect to thank you URL
         wp_redirect($this->get_return_url($order));
         exit;
     } else {
         // Change the status to pending / unpaid
         $order->update_status('pending', __('Payment declined', 'woothemes'));
         // Add a note with the IPG details on it
         $order->add_order_note(__('Braintree payment Failed - TransactionReference: ' . $txnreference . " - ResponseCode: " . $responseCode, 'woocommerce'));
         // FAILURE NOTE
         // Add error for the customer when we return back to the cart
         $woocommerce->add_error(__('TRANSACTION DECLINED: ', 'woothemes') . $posted['responseText'] . "<br/>Reference: " . $txnreference);
         // Redirect back to the last step in the checkout process
         wp_redirect($woocommerce->cart->get_checkout_url());
         exit;
     }
 }
开发者ID:bala223344,项目名称:wordpress-bear,代码行数:45,代码来源:index.php

示例13: confirm_url_callback

 public function confirm_url_callback()
 {
     $transaction_id = $_GET['transactionId'];
     $results = get_posts(array('post_type' => 'shop_order', 'meta_query' => array(array('key' => '_hpd_linepay_transactionId', 'value' => $transaction_id))));
     if (!$results) {
         http_response_code(404);
         exit;
     }
     $order_data = $results[0];
     $order_id = $order_data->ID;
     $order = new WC_Order($order_id);
     $response_data = $this->client->confirm($transaction_id, $order->get_total(), get_woocommerce_currency());
     if ($response_data->returnCode != '0000') {
         $order->update_status('failed', sprintf(__('Error return code: %1$s, message: %2$s', 'wc-payment-gateway-line-pay'), $response_data->returnCode, $response_data->returnMessage));
     } else {
         $order->payment_complete();
     }
     wp_redirect($order->get_checkout_order_received_url());
     exit;
 }
开发者ID:neltseng,项目名称:wc-payment-gateway-line-pay,代码行数:20,代码来源:class-hpd-linepay-gateway.php

示例14: explode

 function check_ipn_response()
 {
     global $woocommerce;
     $posted = $_POST['payment'];
     $hash = sha1(md5($posted . $this->merchant_password));
     if (isset($_POST['payment']) && $hash === $_POST['signature']) {
         $items = explode("&", $_POST['payment']);
         $ar = array();
         foreach ($items as $it) {
             $key = "";
             $value = "";
             list($key, $value) = explode("=", $it, 2);
             $payment_items[$key] = $value;
         }
         $order = new WC_Order($payment_items['order']);
         $order->update_status('processing', __('Платеж успешно оплачен', 'woocommerce'));
         $order->add_order_note(__('Клиент успешно оплатил заказ', 'woocommerce'));
         $woocommerce->cart->empty_cart();
     } else {
         wp_die('IPN Request Failure');
     }
 }
开发者ID:kindaemail,项目名称:privat24,代码行数:22,代码来源:privavat24.php

示例15: 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


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