• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP woocommerce_order_review函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中woocommerce_order_review函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_order_review函数的具体用法?PHP woocommerce_order_review怎么用?PHP woocommerce_order_review使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: update_order_review

 /**
  * AJAX update order review on checkout
  */
 public static function update_order_review()
 {
     ob_start();
     check_ajax_referer('update-order-review', 'security');
     if (!defined('WOOCOMMERCE_CHECKOUT')) {
         define('WOOCOMMERCE_CHECKOUT', true);
     }
     if (WC()->cart->is_empty()) {
         $data = array('fragments' => apply_filters('woocommerce_update_order_review_fragments', array('form.woocommerce-checkout' => '<div class="woocommerce-error">' . __('Sorry, your session has expired.', 'woocommerce') . ' <a href="' . home_url() . '" class="wc-backward">' . __('Return to homepage', 'woocommerce') . '</a></div>')));
         wp_send_json($data);
         die;
     }
     do_action('woocommerce_checkout_update_order_review', $_POST['post_data']);
     $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');
     if (isset($_POST['shipping_method']) && is_array($_POST['shipping_method'])) {
         foreach ($_POST['shipping_method'] as $i => $value) {
             $chosen_shipping_methods[$i] = wc_clean($value);
         }
     }
     WC()->session->set('chosen_shipping_methods', $chosen_shipping_methods);
     WC()->session->set('chosen_payment_method', empty($_POST['payment_method']) ? '' : $_POST['payment_method']);
     if (isset($_POST['country'])) {
         WC()->customer->set_country($_POST['country']);
     }
     if (isset($_POST['state'])) {
         WC()->customer->set_state($_POST['state']);
     }
     if (isset($_POST['postcode'])) {
         WC()->customer->set_postcode($_POST['postcode']);
     }
     if (isset($_POST['city'])) {
         WC()->customer->set_city($_POST['city']);
     }
     if (isset($_POST['address'])) {
         WC()->customer->set_address($_POST['address']);
     }
     if (isset($_POST['address_2'])) {
         WC()->customer->set_address_2($_POST['address_2']);
     }
     if (wc_ship_to_billing_address_only()) {
         if (isset($_POST['country'])) {
             WC()->customer->set_shipping_country($_POST['country']);
         }
         if (isset($_POST['state'])) {
             WC()->customer->set_shipping_state($_POST['state']);
         }
         if (isset($_POST['postcode'])) {
             WC()->customer->set_shipping_postcode($_POST['postcode']);
         }
         if (isset($_POST['city'])) {
             WC()->customer->set_shipping_city($_POST['city']);
         }
         if (isset($_POST['address'])) {
             WC()->customer->set_shipping_address($_POST['address']);
         }
         if (isset($_POST['address_2'])) {
             WC()->customer->set_shipping_address_2($_POST['address_2']);
         }
     } else {
         if (isset($_POST['s_country'])) {
             WC()->customer->set_shipping_country($_POST['s_country']);
         }
         if (isset($_POST['s_state'])) {
             WC()->customer->set_shipping_state($_POST['s_state']);
         }
         if (isset($_POST['s_postcode'])) {
             WC()->customer->set_shipping_postcode($_POST['s_postcode']);
         }
         if (isset($_POST['s_city'])) {
             WC()->customer->set_shipping_city($_POST['s_city']);
         }
         if (isset($_POST['s_address'])) {
             WC()->customer->set_shipping_address($_POST['s_address']);
         }
         if (isset($_POST['s_address_2'])) {
             WC()->customer->set_shipping_address_2($_POST['s_address_2']);
         }
     }
     WC()->cart->calculate_totals();
     // Get order review fragment
     ob_start();
     woocommerce_order_review();
     $woocommerce_order_review = ob_get_clean();
     // Get checkout payment fragment
     ob_start();
     woocommerce_checkout_payment();
     $woocommerce_checkout_payment = ob_get_clean();
     // Get messages if reload checkout is not true
     $messages = '';
     if (!isset(WC()->session->reload_checkout)) {
         ob_start();
         wc_print_notices();
         $messages = ob_get_clean();
     }
     $data = array('result' => empty($messages) ? 'success' : 'failure', 'messages' => $messages, 'reload' => isset(WC()->session->reload_checkout) ? 'true' : 'false', 'fragments' => apply_filters('woocommerce_update_order_review_fragments', array('.woocommerce-checkout-review-order-table' => $woocommerce_order_review, '.woocommerce-checkout-payment' => $woocommerce_checkout_payment)));
     wp_send_json($data);
     die;
//.........这里部分代码省略.........
开发者ID:JodiWarren,项目名称:woocommerce,代码行数:101,代码来源:class-wc-ajax.php


示例2: update_order_review

 /**
  * AJAX update order review on checkout.
  */
 public static function update_order_review()
 {
     check_ajax_referer('update-order-review', 'security');
     wc_maybe_define_constant('WOOCOMMERCE_CHECKOUT', true);
     if (WC()->cart->is_empty()) {
         self::update_order_review_expired();
     }
     do_action('woocommerce_checkout_update_order_review', $_POST['post_data']);
     $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');
     if (isset($_POST['shipping_method']) && is_array($_POST['shipping_method'])) {
         foreach ($_POST['shipping_method'] as $i => $value) {
             $chosen_shipping_methods[$i] = wc_clean($value);
         }
     }
     WC()->session->set('chosen_shipping_methods', $chosen_shipping_methods);
     WC()->session->set('chosen_payment_method', empty($_POST['payment_method']) ? '' : $_POST['payment_method']);
     WC()->customer->set_props(array('billing_country' => isset($_POST['country']) ? $_POST['country'] : null, 'billing_state' => isset($_POST['state']) ? $_POST['state'] : null, 'billing_postcode' => isset($_POST['postcode']) ? $_POST['postcode'] : null, 'billing_city' => isset($_POST['city']) ? $_POST['city'] : null, 'billing_address_1' => isset($_POST['address']) ? $_POST['address'] : null, 'billing_address_2' => isset($_POST['address_2']) ? $_POST['address_2'] : null));
     if (wc_ship_to_billing_address_only()) {
         WC()->customer->set_props(array('shipping_country' => isset($_POST['country']) ? $_POST['country'] : null, 'shipping_state' => isset($_POST['state']) ? $_POST['state'] : null, 'shipping_postcode' => isset($_POST['postcode']) ? $_POST['postcode'] : null, 'shipping_city' => isset($_POST['city']) ? $_POST['city'] : null, 'shipping_address_1' => isset($_POST['address']) ? $_POST['address'] : null, 'shipping_address_2' => isset($_POST['address_2']) ? $_POST['address_2'] : null));
         if (!empty($_POST['country'])) {
             WC()->customer->set_calculated_shipping(true);
         }
     } else {
         WC()->customer->set_props(array('shipping_country' => isset($_POST['s_country']) ? $_POST['s_country'] : null, 'shipping_state' => isset($_POST['s_state']) ? $_POST['s_state'] : null, 'shipping_postcode' => isset($_POST['s_postcode']) ? $_POST['s_postcode'] : null, 'shipping_city' => isset($_POST['s_city']) ? $_POST['s_city'] : null, 'shipping_address_1' => isset($_POST['s_address']) ? $_POST['s_address'] : null, 'shipping_address_2' => isset($_POST['s_address_2']) ? $_POST['s_address_2'] : null));
         if (!empty($_POST['s_country'])) {
             WC()->customer->set_calculated_shipping(true);
         }
     }
     WC()->customer->save();
     WC()->cart->calculate_totals();
     // Get order review fragment
     ob_start();
     woocommerce_order_review();
     $woocommerce_order_review = ob_get_clean();
     // Get checkout payment fragment
     ob_start();
     woocommerce_checkout_payment();
     $woocommerce_checkout_payment = ob_get_clean();
     // Get messages if reload checkout is not true
     $messages = '';
     if (!isset(WC()->session->reload_checkout)) {
         ob_start();
         wc_print_notices();
         $messages = ob_get_clean();
     }
     unset(WC()->session->refresh_totals, WC()->session->reload_checkout);
     wp_send_json(array('result' => empty($messages) ? 'success' : 'failure', 'messages' => $messages, 'reload' => isset(WC()->session->reload_checkout) ? 'true' : 'false', 'fragments' => apply_filters('woocommerce_update_order_review_fragments', array('.woocommerce-checkout-review-order-table' => $woocommerce_order_review, '.woocommerce-checkout-payment' => $woocommerce_checkout_payment))));
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:51,代码来源:class-wc-ajax.php


示例3: woocommerce_order_review

                        <?php 
    }
}
?>
                    </div>
                </div>
            </div>
        </div>

    


        <div id="paypalexpress_order_review" style="display: none;">
                <?php 
woocommerce_order_review();
?>
        </div>

<?php 
if (WC()->cart->needs_shipping()) {
    ?>


  

    <div class="col2-set addresses">

        <div class="col-1">

            <div class="title">
开发者ID:sergioblanco86,项目名称:git-gitlab.com-kinivo-kinivo.com,代码行数:30,代码来源:paypal-review-order.php


示例4: get_hygglig_checkout_page


//.........这里部分代码省略.........
                    //Next part is to ask for the iFrame
                    $getiframeCheckSum = SHA1(strtoupper($token . $sharedSecret));
                    $getiframeAPI = $this->hygglig_server . 'GetIFrame';
                    //Destroy previous $create
                    $create = array();
                    //GetIFrame
                    $create['MerchantKey'] = $merchantid;
                    $create['Checksum'] = $getiframeCheckSum;
                    $create['Token'] = $token;
                    // Setup cURL
                    $ch = curl_init($getiframeAPI);
                    curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HTTPHEADER => array('Content-Type: application/json; encoding=utf-8'), CURLOPT_POSTFIELDS => json_encode($create)));
                    // Send the request
                    $response = curl_exec($ch);
                    // Check for errors
                    if ($response === FALSE) {
                        die(curl_error($ch));
                    } else {
                        //Close Curl
                        curl_close($ch);
                        //Clear old result
                        $responseData = null;
                        //Echo result
                        $responseData = json_decode($response, true, 1024, JSON_BIGINT_AS_STRING);
                    }
                }
                $text = $responseData["HtmlText"];
                // Display checkout
                ob_start();
                // Add CSS
                echo '<link href="' . HYGGLIG_URL . 'css/hygglig.css" rel="stylesheet">';
                if ($this->show_order_review == 'visatopp') {
                    echo '<div id="order_review" class="woocommerce-checkout-review-order">';
                    woocommerce_order_review();
                    echo '</div><br>';
                }
                //Hygglig iFrame render
                echo $text;
                if ($this->show_order_review == 'visaunder') {
                    echo '<br><div id="order_review" class="woocommerce-checkout-review-order">';
                    woocommerce_order_review();
                    echo '</div>';
                }
                //Close WooCommerce Div and Form
                echo "</form></div>";
                //Add update code
                ?>
<script>
//Script that do AJAX req and then based on answer updates checkout
window.onload = function() {
	if (window.jQuery) {  
		// jQuery is loaded 
		$j=jQuery.noConflict();
		//Do update to store current shipping
		$j.get( window.location.href);
		//Store val
		dataVal = $j('.order-total .amount').text();
		checker(dataVal);
	} 
	else {
		// jQuery is not loaded - implement solution using pure javascript
	}
}

function checker(oldVal){
	if(oldVal == $j('.order-total .amount').text()){
开发者ID:Hygglig,项目名称:New_Hygglig_WooCommerce,代码行数:67,代码来源:class-hygglig-checkout.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP woocommerce_page_title函数代码示例发布时间:2022-05-23
下一篇:
PHP woocommerce_mini_cart函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap