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


PHP WC_Order::has_downloadable_item方法代码示例

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


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

示例1: array

        /**
         * Verify a successful Payment!
         * */
        function check_alphabank_response()
        {
            global $woocommerce;
            global $wpdb;
            //if (( preg_match( '/success/i', $_SERVER['REQUEST_URI'] ) && preg_match( '/alphabank/i', $_SERVER['REQUEST_URI'] ) )) {
            //			$merchantreference= $_GET['MerchantReference'];
            $post_data_array = array();
            if (isset($_POST['mid'])) {
                $post_data_array[0] = $_POST['mid'];
            }
            if (isset($_POST['orderid'])) {
                $post_data_array[1] = $_POST['orderid'];
            }
            if (isset($_POST['status'])) {
                $post_data_array[2] = $_POST['status'];
            }
            if (isset($_POST['orderAmount'])) {
                $post_data_array[3] = $_POST['orderAmount'];
            }
            if (isset($_POST['currency'])) {
                $post_data_array[4] = $_POST['currency'];
            }
            if (isset($_POST['paymentTotal'])) {
                $post_data_array[5] = $_POST['paymentTotal'];
            }
            if (isset($_POST['message'])) {
                $post_data_array[6] = $_POST['message'];
            }
            if (isset($_POST['riskScore'])) {
                $post_data_array[7] = $_POST['riskScore'];
            }
            if (isset($_POST['payMethod'])) {
                $post_data_array[8] = $_POST['payMethod'];
            }
            if (isset($_POST['txId'])) {
                $post_data_array[9] = $_POST['txId'];
            }
            if (isset($_POST['paymentRef'])) {
                $post_data_array[10] = $_POST['paymentRef'];
            }
            $post_data_array[11] = $_POST['digest'];
            $post_DIGEST = $_POST['digest'];
            $post_data = implode("", $post_data_array);
            $digest = base64_encode(sha1(utf8_encode($post_data), true));
            if ($this->mode == "yes") {
                //test mode
                $post_url = 'https://alpha.test.modirum.com/vpos/shophandlermpi';
            } else {
                //live mode
                $post_url = 'https://www.alphaecommerce.gr/vpos/shophandlermpi';
            }
            //
            $ttquery = 'SELECT *
				FROM `' . $wpdb->prefix . 'alphabank_transactions`
				WHERE `orderid` = "' . $_POST['orderid'] . '";';
            $ref = $wpdb->get_results($ttquery);
            $merchantreference = $_GET['MerchantReference'];
            $orderid = $ref['0']->orderid;
            $order = new WC_Order($orderid);
            //$order = $_POST['orderid'];
            if ($_POST['status'] == 'AUTHORIZED' || $_POST['status'] == 'CAPTURED') {
                //verified - successful payment
                //complete order
                if ($order->status == 'processing') {
                    $order->add_order_note(__('Payment Via alphabank<br />Transaction ID: ', 'woocommerce-alphabank-payment-gateway') . $trans_id);
                    //Add customer order note
                    $order->add_order_note(__('Payment Received.<br />Your order is currently being processed.<br />We will be shipping your order to you soon.<br />alphabank Transaction ID: ', 'woocommerce-alphabank-payment-gateway') . $trans_id, 1);
                    // Reduce stock levels
                    $order->reduce_order_stock();
                    // Empty cart
                    WC()->cart->empty_cart();
                    $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is currently being processed.', 'woocommerce-alphabank-payment-gateway');
                    $message_type = 'success';
                } else {
                    if ($order->has_downloadable_item()) {
                        //Update order status
                        $order->update_status('completed', __('Payment received, your order is now complete.', 'woocommerce-alphabank-payment-gateway'));
                        //Add admin order note
                        $order->add_order_note(__('Payment Via alphabank Payment Gateway<br />Transaction ID: ', 'woocommerce-alphabank-payment-gateway') . $trans_id);
                        //Add customer order note
                        $order->add_order_note(__('Payment Received.<br />Your order is now complete.<br />alphabank Transaction ID: ', 'woocommerce-alphabank-payment-gateway') . $trans_id, 1);
                        $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is now complete.', 'woocommerce-alphabank-payment-gateway');
                        $message_type = 'success';
                    } else {
                        //Update order status
                        $order->update_status('processing', __('Payment received, your order is currently being processed.', 'woocommerce-alphabank-payment-gateway'));
                        //Add admin order note
                        $order->add_order_note(__('Payment Via alphabank Payment Gateway<br />Transaction ID: ', 'woocommerce-alphabank-payment-gateway') . $trans_id);
                        //Add customer order note
                        $order->add_order_note(__('Payment Received.<br />Your order is currently being processed.<br />We will be shipping your order to you soon.<br />alphabank Transaction ID: ', 'woocommerce-alphabank-payment-gateway') . $trans_id, 1);
                        $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is currently being processed.', 'woocommerce-alphabank-payment-gateway');
                        $message_type = 'success';
                    }
                    $alphabank_message = array('message' => $message, 'message_type' => $message_type);
                    update_post_meta($order_id, '_alphabank_message', $alphabank_message);
                    // Reduce stock levels
                    $order->reduce_order_stock();
//.........这里部分代码省略.........
开发者ID:eellak,项目名称:woocommerce-alphabank-payment-gateway,代码行数:101,代码来源:woocommerce-alphabank-payment-gateway.php

示例2: translateEmailHeadingCustomerCompletedOrder

 /**
  * Translate to the order language, the email heading of completed order email notifications to the customer.
  *
  * @param string   $heading Email heading in default language
  * @param WC_Order $order   Order object
  *
  * @return string Translated heading
  */
 public function translateEmailHeadingCustomerCompletedOrder($heading, $order)
 {
     if (!empty($order) && $order->has_downloadable_item()) {
         return $this->translateEmailStringToOrderLanguage($subject, $order, 'heading_downloadable', 'customer_completed_order');
     } else {
         return $this->translateEmailStringToOrderLanguage($heading, $order, 'heading', 'customer_completed_order');
     }
 }
开发者ID:hyyan,项目名称:woo-poly-integration,代码行数:16,代码来源:Emails.php

示例3:

 /**
  * Test: has_downloadable_item
  */
 function test_has_downloadable_item()
 {
     $object = new WC_Order();
     $this->assertFalse($object->has_downloadable_item());
     $object = WC_Helper_Order::create_order();
     $this->assertFalse($object->has_downloadable_item());
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:10,代码来源:crud.php

示例4: sprintf

 /**
  * Completed Order
  **/
 function customer_completed_order($order_id)
 {
     $order = new WC_Order($order_id);
     if ($order->has_downloadable_item()) {
         $subject = __('[%s] Order Complete/Download Links', 'woocommerce');
         $email_heading = __('Order Complete/Download Links', 'woocommerce');
     } else {
         $subject = __('[%s] Order Complete', 'woocommerce');
         $email_heading = __('Order Complete', 'woocommerce');
     }
     $email_heading = apply_filters('woocommerce_completed_order_customer_notification_subject', $email_heading);
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $subject = apply_filters('woocommerce_email_subject_customer_completed_order', sprintf($subject, $blogname), $order);
     // Buffer
     ob_start();
     // Get mail template
     woocommerce_get_template('emails/customer-completed-order.php', array('order' => $order, 'email_heading' => $email_heading));
     // Get contents
     $message = ob_get_clean();
     //	CC, BCC, additional headers
     $headers = apply_filters('woocommerce_email_headers', '', 'customer_completed_order');
     // Attachments
     $attachments = apply_filters('woocommerce_email_attachments', '', 'customer_completed_order');
     // Send the mail
     $this->send($order->billing_email, $subject, $message, $headers, $attachments);
 }
开发者ID:rosslavery,项目名称:woocommerce,代码行数:29,代码来源:class-wc-email.php

示例5: array

        /**
         * Verify a successful Payment!
         * */
        function check_piraeusbank_response()
        {
            global $woocommerce;
            global $wpdb;
            if (isset($_GET['peiraeus']) && $_GET['peiraeus'] == 'success') {
                $ResultCode = $_GET['ResultCode'];
                if ($ResultCode != 0) {
                    $message = __('A technical problem occured. <br />The transaction wasn\'t successful, payment wasn\'t received.', 'woocommerce-piraeusbank-payment-gateway');
                    $message_type = 'error';
                    $pb_message = array('message' => $message, 'message_type' => $message_type);
                    update_post_meta($order_id, '_piraeusbank_message', $pb_message);
                    //Update the order status
                    $order->update_status('failed', '');
                    $checkout_url = $woocommerce->cart->get_checkout_url();
                    wp_redirect($checkout_url);
                    exit;
                }
                $ResponseCode = $_GET['ResponseCode'];
                $StatusFlag = $_GET['StatusFlag'];
                $HashKey = $_GET['HashKey'];
                $SupportReferenceID = $_GET['SupportReferenceID'];
                $ApprovalCode = $_GET['ApprovalCode'];
                $Parameters = $_GET['Parameters'];
                $AuthStatus = $_GET['AuthStatus'];
                $PackageNo = $_GET['PackageNo'];
                $order_id = $_GET['MerchantReference'];
                $order = new WC_Order($order_id);
                $ttquery = 'SELECT trans_ticket
			FROM `' . $wpdb->prefix . 'piraeusbank_transactions`
			WHERE `merch_ref` = ' . $order_id . '	;';
                $tt = $wpdb->get_results($ttquery);
                $transticket = $tt['0']->trans_ticket;
                //concatenate string
                $stcon = $transticket . $this->pb_PosId . $this->pb_AcquirerId . $order_id . $ApprovalCode . $Parameters . $ResponseCode . $SupportReferenceID . $AuthStatus . $PackageNo . $StatusFlag;
                //hash concatenated string
                $conhash = strtoupper(hash('sha256', $stcon));
                if ($conhash != $HashKey) {
                    $message = __('Thank you for shopping with us. <br />However, the transaction wasn\'t successful, payment wasn\'t received.', 'woocommerce-piraeusbank-payment-gateway');
                    $message_type = 'error';
                    $pb_message = array('message' => $message, 'message_type' => $message_type);
                    update_post_meta($order_id, '_piraeusbank_message', $pb_message);
                    //Update the order status
                    $order->update_status('failed', '');
                    $checkout_url = $woocommerce->cart->get_checkout_url();
                    wp_redirect($checkout_url);
                    exit;
                } else {
                    if ($ResponseCode == 0 || $ResponseCode == 8 || $ResponseCode == 10 || $ResponseCode == 16) {
                        if ($order->status == 'processing') {
                            $order->add_order_note(__('Payment Via Peiraeus Bank<br />Transaction ID: ', 'woocommerce-piraeusbank-payment-gateway') . $SupportReferenceID);
                            //Add customer order note
                            $order->add_order_note(__('Payment Received.<br />Your order is currently being processed.<br />We will be shipping your order to you soon.<br />Peiraeus Bank ID: ', 'woocommerce-piraeusbank-payment-gateway') . $SupportReferenceID, 1);
                            // Reduce stock levels
                            $order->reduce_order_stock();
                            // Empty cart
                            WC()->cart->empty_cart();
                            $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is currently being processed.', 'woocommerce-piraeusbank-payment-gateway');
                            $message_type = 'success';
                        } else {
                            if ($order->has_downloadable_item()) {
                                //Update order status
                                $order->update_status('completed', __('Payment received, your order is now complete.', 'woocommerce-piraeusbank-payment-gateway'));
                                //Add admin order note
                                $order->add_order_note(__('Payment Via Peiraeus Bank<br />Transaction ID: ', 'woocommerce-piraeusbank-payment-gateway') . $SupportReferenceID);
                                //Add customer order note
                                $order->add_order_note(__('Payment Received.<br />Your order is now complete.<br />Peiraeus Transaction ID: ', 'woocommerce-piraeusbank-payment-gateway') . $SupportReferenceID, 1);
                                $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is now complete.', 'woocommerce-piraeusbank-payment-gateway');
                                $message_type = 'success';
                            } else {
                                //Update order status
                                $order->update_status('processing', __('Payment received, your order is currently being processed.', 'woocommerce-piraeusbank-payment-gateway'));
                                //Add admin order note
                                $order->add_order_note(__('Payment Via Peiraeus Bank<br />Transaction ID: ', 'woocommerce-piraeusbank-payment-gateway') . $SupportReferenceID);
                                //Add customer order note
                                $order->add_order_note(__('Payment Received.<br />Your order is currently being processed.<br />We will be shipping your order to you soon.<br />Peiraeus Bank ID: ', 'woocommerce-piraeusbank-payment-gateway') . $SupportReferenceID, 1);
                                $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is currently being processed.', 'woocommerce-piraeusbank-payment-gateway');
                                $message_type = 'success';
                            }
                            $pb_message = array('message' => $message, 'message_type' => $message_type);
                            update_post_meta($order_id, '_piraeusbank_message', $pb_message);
                            // Reduce stock levels
                            $order->reduce_order_stock();
                            // Empty cart
                            WC()->cart->empty_cart();
                        }
                    } else {
                        if ($ResponseCode == 11) {
                            $message = __('Thank you for shopping with us.<br />Your transaction was previously received.<br />', 'woocommerce-piraeusbank-payment-gateway');
                            $message_type = 'success';
                            $pb_message = array('message' => $message, 'message_type' => $message_type);
                            update_post_meta($order_id, '_piraeusbank_message', $pb_message);
                        } else {
                            //Failed Response codes
                            $message = __('Thank you for shopping with us. <br />However, the transaction wasn\'t successful, payment wasn\'t received.', 'woocommerce-piraeusbank-payment-gateway');
                            $message_type = 'error';
                            $pb_message = array('message' => $message, 'message_type' => $message_type);
                            update_post_meta($order_id, '_piraeusbank_message', $pb_message);
//.........这里部分代码省略.........
开发者ID:fovoc,项目名称:Woocommerce-Payment-Gateways-Greek-Banks,代码行数:101,代码来源:woocommerce-piraeusbank-payment-gateway.php

示例6: SimpleXMLExtended

        /**
         * Verify a successful Payment!
         * */
        function check_nbg_response()
        {
            global $woocommerce;
            global $wpdb;
            if (isset($_GET['nbg']) && $_GET['nbg'] === 'success') {
                $merchantreference = $_GET['MerchantReference'];
                //query DB
                $ttquery = 'SELECT *
				FROM `' . $wpdb->prefix . 'nbg_transactions`
				WHERE `merchantreference` like "' . $merchantreference . '"	;';
                $ref = $wpdb->get_results($ttquery);
                $orderid = $ref['0']->orderid;
                $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="utf-8"?><Request version="2"/>');
                $authentication = $xml->addChild('Authentication');
                $authentication->addChild('password', $this->nbg_Password);
                $authentication->addChild('client', $this->nbg_Username);
                $transaction = $xml->addChild('Transaction');
                $HistoricTxn = $transaction->addChild('HistoricTxn');
                $HistoricTxn->addChild('reference', $ref['0']->reference);
                $HistoricTxn->addChild('method', 'query');
                if ($this->mode == "yes") {
                    //test mode
                    $post_url = 'https://accreditation.datacash.com/Transaction/acq_a';
                } else {
                    //live mode
                    $post_url = 'https://mars.transaction.datacash.com/Transaction';
                }
                // make CURL request
                $ch = curl_init($post_url);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $xml->asXML());
                curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_NOPROGRESS, 0);
                $result = curl_exec($ch);
                // result will contain XML reply
                curl_close($ch);
                if ($result == false) {
                    return __('Could not connect to NBG server, please contact the administrator ', 'woocommerce-nbg-payment-gateway');
                }
                //Response
                $response = simplexml_load_string($result);
                $order = new WC_Order($orderid);
                if ($response->status == 1) {
                    if (strcmp($response->reason, 'ACCEPTED') == 0) {
                        //verified - successful payment
                        //complete order
                        if ($order->status == 'processing') {
                            $order->add_order_note(__('Payment Via NBG<br />Transaction ID: ', 'woocommerce-nbg-payment-gateway') . $trans_id);
                            //Add customer order note
                            $order->add_order_note(__('Payment Received.<br />Your order is currently being processed.<br />We will be shipping your order to you soon.<br />NBG Transaction ID: ', 'woocommerce-nbg-payment-gateway') . $trans_id, 1);
                            // Reduce stock levels
                            $order->reduce_order_stock();
                            // Empty cart
                            WC()->cart->empty_cart();
                            $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is currently being processed.', 'woocommerce-nbg-payment-gateway');
                            $message_type = 'success';
                        } else {
                            if ($order->has_downloadable_item()) {
                                //Update order status
                                $order->update_status('completed', __('Payment received, your order is now complete.', 'woocommerce-nbg-payment-gateway'));
                                //Add admin order note
                                $order->add_order_note(__('Payment Via NBG Payment Gateway<br />Transaction ID: ', 'woocommerce-nbg-payment-gateway') . $trans_id);
                                //Add customer order note
                                $order->add_order_note(__('Payment Received.<br />Your order is now complete.<br />NBG Transaction ID: ', 'woocommerce-nbg-payment-gateway') . $trans_id, 1);
                                $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is now complete.', 'woocommerce-nbg-payment-gateway');
                                $message_type = 'success';
                            } else {
                                //Update order status
                                $order->update_status('processing', __('Payment received, your order is currently being processed.', 'woocommerce-nbg-payment-gateway'));
                                //Add admin order note
                                $order->add_order_note(__('Payment Via NBG Payment Gateway<br />Transaction ID: ', 'woocommerce-nbg-payment-gateway') . $trans_id);
                                //Add customer order note
                                $order->add_order_note(__('Payment Received.<br />Your order is currently being processed.<br />We will be shipping your order to you soon.<br />NBG Transaction ID: ', 'woocommerce-nbg-payment-gateway') . $trans_id, 1);
                                $message = __('Thank you for shopping with us.<br />Your transaction was successful, payment was received.<br />Your order is currently being processed.', 'woocommerce-nbg-payment-gateway');
                                $message_type = 'success';
                            }
                            $nbg_message = array('message' => $message, 'message_type' => $message_type);
                            update_post_meta($order_id, '_nbg_message', $nbg_message);
                            // Reduce stock levels
                            $order->reduce_order_stock();
                            // Empty cart
                            WC()->cart->empty_cart();
                        }
                    } else {
                        //payment has failed - retry
                        $message = __('Thank you for shopping with us. <br />However, the transaction wasn\'t successful, payment wasn\'t received.', 'woocommerce-nbg-payment-gateway');
                        $message_type = 'error';
                        $nbg_message = array('message' => $message, 'message_type' => $message_type);
                        update_post_meta($order_id, '_nbg_message', $pb_message);
                        //Update the order status
                        $order->update_status('failed', '');
                        $checkout_url = $woocommerce->cart->get_checkout_url();
                        wp_redirect($checkout_url);
                        exit;
                    }
                } else {
//.........这里部分代码省略.........
开发者ID:fovoc,项目名称:Woocommerce-Payment-Gateways-Greek-Banks,代码行数:101,代码来源:woocommerce-nbg-payment-gateway.php

示例7:

 /**
  * Translate to the order language, the email heading of completed order email notifications to the customer
  *
  * @param string    $heading    Email heading in default language
  * @param WC_Order  $order      Order object
  *
  * @return string   Translated heading
  */
 function translate_email_heading_customer_completed_order($heading, $order)
 {
     if (!empty($order) && $order->has_downloadable_item()) {
         return $this->translate_email_string_to_order_language($subject, $order, 'heading_downloadable', 'customer_completed_order');
     } else {
         return $this->translate_email_string_to_order_language($heading, $order, 'heading', 'customer_completed_order');
     }
 }
开发者ID:decarvalhoaa,项目名称:woopoly,代码行数:16,代码来源:Emails.php


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