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

PHP is_order_received_page函数代码示例

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

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



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

示例1: create_print_button_order_page

        /**
         * Create a print button for the 'View Order' page
         */
        public function create_print_button_order_page($order_id)
        {
            $order = new WC_Order($order_id);
            // Output the button only when the option is enabled
            if (get_option(WooCommerce_Delivery_Notes::$plugin_prefix . 'print_button_on_view_order_page')) {
                // Default button for all pages and logged in users
                $print_url = wcdn_get_print_link($order_id, $this->get_template_type($order));
                // Pass the email to the url for the tracking
                // and thank you page. This allows to view the
                // print page without logging in.
                if ($this->is_woocommerce_tracking_page()) {
                    $print_url = wcdn_get_print_link($order_id, $this->get_template_type($order), $_REQUEST['order_email']);
                }
                // Thank you page
                if (is_order_received_page() && !is_user_logged_in()) {
                    // Don't output the butten when there is no email
                    if (!$order->billing_email) {
                        return;
                    }
                    $print_url = wcdn_get_print_link($order_id, $this->get_template_type($order), $order->billing_email);
                }
                ?>
				<p class="order-print">
					<a href="<?php 
                echo $print_url;
                ?>
" class="button print"><?php 
                _e('Print', 'woocommerce-delivery-notes');
                ?>
</a>
				</p>
				<?php 
            }
        }
开发者ID:flasomm,项目名称:Montkailash,代码行数:37,代码来源:class-wcdn-theme.php


示例2: ctala_theme_name_scripts

function ctala_theme_name_scripts()
{
    if (is_order_received_page() || is_checkout()) {
        $dir = plugin_dir_url(__FILE__);
        $bootstrapMin = $dir . "css/bootstrap.min.css";
        wp_enqueue_style('ctala_bootstrap', $bootstrapMin);
    }
}
开发者ID:ctala,项目名称:WooMercadoPagosChile,代码行数:8,代码来源:WooMercadoPagosChile.php


示例3: tapfiliate

function tapfiliate()
{
    global $post;
    $postName = $post ? $post->post_name : null;
    $tap_account_id = get_option('tap_account_id');
    $integrate_for = get_option('integrate_for');
    $thank_you_page = get_option('thank_you_page');
    $query_parameter_transaction_id = get_option('query_parameter_transaction_id');
    $query_parameter_transaction_amount = get_option('query_parameter_transaction_amount');
    ?>
<script src="//tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
<script type="text/javascript">
  window['TapfiliateObject'] = i = 'tap';
  window[i] = window[i] || function () {
      (window[i].q = window[i].q || []).push(arguments);
  };

  tap('create', '<?php 
    echo $tap_account_id;
    ?>
');
  <?php 
    if ($integrate_for == 'wp') {
        if ($postName == $thank_you_page) {
            $cid = isset($_GET[$query_parameter_transaction_id]) && !empty($_GET[$query_parameter_transaction_id]) ? "'{$_GET[$query_parameter_transaction_id]}'" : 'null';
            $cam = isset($_GET[$query_parameter_transaction_amount]) && !empty($_GET[$query_parameter_transaction_amount]) ? $_GET[$query_parameter_transaction_amount] : 'null';
            echo "tap('conversion', {$cid}, {$cam});";
        } else {
            echo "tap('detectClick');";
        }
    } elseif ($integrate_for == 'wc') {
        if (function_exists("is_order_received_page") && is_order_received_page()) {
            if (isset($GLOBALS['order-received'])) {
                $order_id = apply_filters('woocommerce_thankyou_order_id', absint($GLOBALS['order-received']));
                $order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key']));
                if ($order_id > 0) {
                    $order = new WC_Order($order_id);
                    if ($order->order_key != $order_key) {
                        unset($order);
                    }
                }
                echo "tap('conversion', '{$order->id}', {$order->get_total()});";
            }
        } else {
            echo "tap('detectClick');";
        }
    }
    ?>
</script>
<?php 
}
开发者ID:ErikTVF,项目名称:Shopping-Cart-Integrations,代码行数:51,代码来源:tapfiliate.php


示例4: display_tracking_code

 /**
  * Display tracking code globally and on the order received page
  *
  * @return string
  */
 public function display_tracking_code()
 {
     global $wp;
     if (is_admin() || current_user_can('manage_options')) {
         return;
     }
     $this->output_global_tracking_code();
     if (is_order_received_page()) {
         $order_id = isset($wp->query_vars['order-received']) ? $wp->query_vars['order-received'] : 0;
         if (0 < $order_id) {
             $this->output_order_tracking_code($order_id);
         }
     }
 }
开发者ID:strikewood,项目名称:woocommerce-affiliate-tracking,代码行数:19,代码来源:class-wc-affiliate-tracking-integration.php


示例5: tracking_code_display

 /**
  * Display the tracking codes
  *
  * @return string
  */
 public function tracking_code_display()
 {
     global $wp;
     $display_ecommerce_tracking = false;
     if (is_admin() || current_user_can('manage_options') || !$this->ga_id) {
         return;
     }
     // Check if is order received page and stop when the products and not tracked
     if (is_order_received_page() && 'yes' == $this->ga_ecommerce_tracking_enabled) {
         $order_id = isset($wp->query_vars['order-received']) ? $wp->query_vars['order-received'] : 0;
         if (0 < $order_id && 1 != get_post_meta($order_id, '_ga_tracked', true)) {
             $display_ecommerce_tracking = true;
             echo $this->get_ecommerce_tracking_code($order_id);
         }
     }
     if (!$display_ecommerce_tracking && 'yes' == $this->ga_standard_tracking_enabled) {
         echo $this->get_google_tracking_code();
     }
 }
开发者ID:jmead,项目名称:trucell-cms,代码行数:24,代码来源:class-wc-google-analytics.php


示例6: colabs_wc_template_loader

/**
 * Override template on WooCommerce Page
 */
function colabs_wc_template_loader($template)
{
    global $post;
    if (colabs_check_plugin_active('woocommerce/woocommerce.php')) {
        $myaccount_page_id = wc_get_page_id('myaccount');
        // My Account Page
        if ($post->ID == $myaccount_page_id) {
            $template = locate_template(array('woocommerce/page-myaccount.php'));
        } else {
            if (is_cart()) {
                $template = locate_template(array('woocommerce/page-cart.php'));
            } else {
                if (is_checkout()) {
                    $template = locate_template(array('woocommerce/page-checkout.php'));
                } else {
                    if (is_order_received_page()) {
                        $template = locate_template(array('woocommerce/page-thanks.php'));
                    }
                }
            }
        }
    }
    return $template;
}
开发者ID:pedrofalc,项目名称:mvpcearasteel,代码行数:27,代码来源:theme-woocommerce.php


示例7: woo_layout_body_class

 function woo_layout_body_class($classes)
 {
     global $post, $wp_query, $woo_options;
     $layout = '';
     // Single post layout
     if (is_singular()) {
         // Get layout setting from single post Custom Settings panel
         $layout = get_post_meta($post->ID, 'layout', true);
         // Set to single post layout if selected
         if ($layout != '') {
             $woo_options['woo_layout'] = $layout;
             // Portfolio single post layout option.
         } elseif (get_post_type() == 'portfolio') {
             $portfolio_single_layout = get_option('woo_portfolio_layout_single');
             if ($portfolio_single_layout != '') {
                 $layout = $portfolio_single_layout;
                 $woo_options['woo_layout'] = $portfolio_single_layout;
             }
         }
     }
     // Set default global layout
     if ($layout == '') {
         $layout = get_option('woo_layout');
         if ($layout == '') {
             $layout = 'two-col-left';
         }
     }
     // Portfolio gallery layout option.
     if (is_tax('portfolio-gallery') || is_post_type_archive('portfolio') || is_page_template('template-portfolio.php')) {
         $portfolio_gallery_layout = get_option('woo_portfolio_layout');
         if ($portfolio_gallery_layout != '') {
             $layout = $portfolio_gallery_layout;
         }
     }
     if (is_tax('portfolio-gallery') || is_post_type_archive('portfolio') || is_page_template('template-portfolio.php') || is_singular() && get_post_type() == 'portfolio') {
         $classes[] = 'portfolio-component';
     }
     // WooCommerce Layout
     if (class_exists('woocommerce') && function_exists('is_shop') && function_exists('is_cart') && function_exists('is_checkout') && function_exists('is_account_page') && function_exists('is_product') && function_exists('is_order_received_page') && (is_woocommerce() || is_shop() || is_cart() || is_checkout() || is_account_page() || is_product() || is_order_received_page())) {
         // Set defaul layout
         $woocommerce_layout = get_option('woo_wc_layout');
         if ($woocommerce_layout != '') {
             $layout = $woocommerce_layout;
             $woo_options['woo_layout'] = $woocommerce_layout;
         }
         // WooCommerce single post/page
         if (is_singular()) {
             // Get layout setting from single post Custom Settings panel
             $single_layout = get_post_meta($post->ID, 'layout', true);
             // Set to single post layout if selected
             if ($single_layout != '') {
                 $woo_options['woo_layout'] = $single_layout;
                 $layout = $single_layout;
             }
         }
     }
     // Specify site width
     $width = intval(str_replace('px', '', get_option('woo_layout_width', '960')));
     // Add classes to body_class() output
     $classes[] = $layout;
     $classes[] = 'width-' . $width;
     $classes[] = $layout . '-' . $width;
     return $classes;
 }
开发者ID:kawaisin,项目名称:boylan-child,代码行数:64,代码来源:theme-actions.php


示例8: onOrderDetails

 /**
  * @param WC_Order $order
  */
 public static function onOrderDetails(WC_Order $order)
 {
     if (is_order_received_page()) {
         /**
          * Do not show instruction again below details on order received page
          * Instructions already displayed on top of order received page by $gateway->thankyou_page()
          *
          * @see Mollie_WC_Gateway_Abstract::thankyou_page
          */
         return;
     }
     $gateway = Mollie_WC_Plugin::getDataHelper()->getWcPaymentGatewayByOrder($order);
     if (!$gateway || !$gateway instanceof Mollie_WC_Gateway_Abstract) {
         return;
     }
     /** @var Mollie_WC_Gateway_Abstract $gateway */
     $gateway->displayInstructions($order);
 }
开发者ID:vanengers,项目名称:WooCommerce,代码行数:21,代码来源:plugin.php


示例9: gtm4wp_woocommerce_datalayer_filter_items

function gtm4wp_woocommerce_datalayer_filter_items($dataLayer)
{
    global $woocommerce, $gtm4wp_options, $wp_query, $gtm4wp_datalayer_name, $gtm4wp_product_counter;
    if (is_product_category() || is_product_tag() || is_front_page() || is_shop()) {
        if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING] || true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
            if (count($woocommerce->query->filtered_product_ids) > 0) {
                // The following 5 lines are being borrowed from WC source
                $paged = max(1, $wp_query->get('paged'));
                $per_page = $wp_query->get('posts_per_page');
                $total = $wp_query->found_posts;
                $first = $per_page * $paged - $per_page + 1;
                $last = min($total, $wp_query->get('posts_per_page') * $paged);
                $gtm4wp_product_counter = $first;
                $sumprice = 0;
                $product_ids = array();
                $product_impressions = array();
                $_temp_product_id_list = $woocommerce->query->filtered_product_ids;
                $i = $first - 1;
                foreach ($_temp_product_id_list as $itemid => $oneproductid) {
                    $product = get_product($oneproductid);
                    if (false === $product) {
                        continue;
                    }
                    $product_price = $product->get_price();
                    $_product_cats = get_the_terms($product->id, 'product_cat');
                    if (is_array($_product_cats) && count($_product_cats) > 0) {
                        $product_cat = array_pop($_product_cats);
                        $product_cat = $product_cat->name;
                    } else {
                        $product_cat = "";
                    }
                    $sumprice += $product_price;
                    $product_ids[] = "'" . $oneproductid . "'";
                    $product_impressions[] = "{'name': '" . str_replace("'", "\\'", $product->get_title()) . "', 'id': '" . $oneproductid . "', 'price': '" . $product_price . "', 'category': '" . str_replace("'", "\\'", $product_cat) . "', 'position': " . ($i + 1) . " }";
                    $i++;
                    if ($i > $last) {
                        break;
                    }
                }
                if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING]) {
                    $dataLayer["ecomm_prodid"] = '-~-[' . implode(", ", $product_ids) . ']-~-';
                    $dataLayer["ecomm_pagetype"] = is_front_page() ? "home" : "category";
                    $dataLayer["ecomm_totalvalue"] = $sumprice;
                }
                if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
                    $dataLayer["ecommerce"] = "-~-{'impressions': [" . implode(", ", $product_impressions) . "]}-~-";
                }
            }
        }
    } else {
        if (is_product()) {
            if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING] || true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
                $prodid = get_the_ID();
                $product = get_product($prodid);
                $product_price = $product->get_price();
                $_product_cats = get_the_terms($product->id, 'product_cat');
                if (is_array($_product_cats) && count($_product_cats) > 0) {
                    $product_cat = array_pop($_product_cats);
                    $product_cat = $product_cat->name;
                } else {
                    $product_cat = "";
                }
                if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING]) {
                    $dataLayer["ecomm_prodid"] = $prodid;
                    $dataLayer["ecomm_pagetype"] = "product";
                    $dataLayer["ecomm_totalvalue"] = $product_price;
                }
                if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
                    $dataLayer["ecommerce"] = "-~-{'detail': {'products': [{'name': '" . str_replace("'", "", get_the_title()) . "', 'id': '" . $prodid . "', 'price': '" . $product_price . "', 'category': '" . str_replace("'", "", $product_cat) . "'}]}}-~-";
                }
            }
        } else {
            if (is_cart()) {
                if (true === $gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCTRACKENHANCEDEC]) {
                    gtm4wp_woocommerce_addjs("\r\n\t\t\$('.product-remove').click(function() {\r\n\t\t\tvar productdata = \$( this )\r\n\t\t\t\t.parent()\r\n\t\t\t\t.find( '.gtm4wp_productdata' );\r\n\t\t\t\r\n\t\t\t" . $gtm4wp_datalayer_name . ".push({\r\n\t\t\t\t'event': 'gtm4wp.removeFromCart',\r\n\t\t\t\t'ecommerce': {\r\n\t\t\t\t\t'remove': {\r\n\t\t\t\t\t\t'products': [{\r\n\t\t\t\t\t\t\t'name':     productdata.data( 'product_name' ),\r\n\t\t\t\t\t\t\t'id':       productdata.data( 'product_id' ),\r\n\t\t\t\t\t\t\t'price':    productdata.data( 'product_price' ),\r\n\t\t\t\t\t\t\t'category': productdata.data( 'product_cat' ),\r\n\t\t\t\t\t\t\t'quantity': \$( this ).parent().parent().find( '.product-quantity input.qty' ).val()\r\n\t\t\t\t\t\t}]\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t\t\t");
                }
                if ($gtm4wp_options[GTM4WP_OPTION_INTEGRATE_WCREMARKETING]) {
                    $products = $woocommerce->cart->get_cart();
                    $product_ids = array();
                    foreach ($products as $oneproduct) {
                        $product_ids[] = "'" . str_replace("'", "\\'", $oneproduct['product_id']) . "'";
                    }
                    $dataLayer["ecomm_prodid"] = '-~-[' . implode(", ", $product_ids) . ']-~-';
                    $dataLayer["ecomm_pagetype"] = "cart";
                    $dataLayer["ecomm_totalvalue"] = $woocommerce->cart->cart_contents_total;
                }
            } else {
                if (is_order_received_page()) {
                    $order_id = apply_filters('woocommerce_thankyou_order_id', empty($_GET['order']) ? $GLOBALS["wp"]->query_vars["order-received"] ? $GLOBALS["wp"]->query_vars["order-received"] : 0 : absint($_GET['order']));
                    $order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : woocommerce_clean($_GET['key']));
                    if ($order_id > 0) {
                        $order = new WC_Order($order_id);
                        if ($order->order_key != $order_key) {
                            unset($order);
                        }
                    }
                    if (1 == get_post_meta($order_id, '_ga_tracked', true)) {
                        unset($order);
                    }
                    if (isset($order)) {
//.........这里部分代码省略.........
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:101,代码来源:woocommerce.php


示例10: subscription_switch_handler

 /**
  * Handles the subscription upgrade/downgrade process.
  *
  * @since 1.4
  */
 public static function subscription_switch_handler()
 {
     global $woocommerce, $post;
     // If the current user doesn't own the subscription, remove the query arg from the URL
     if (isset($_GET['switch-subscription'])) {
         // Visiting a switch link for someone elses subscription
         if (!WC_Subscriptions_Manager::user_owns_subscription($_GET['switch-subscription'])) {
             wp_redirect(remove_query_arg('switch-subscription'));
             exit;
         } else {
             if (isset($_GET['auto-switch'])) {
                 $switch_message = __('You have an active subscription to this product. Choosing a new subscription will replace your existing subscription.', 'woocommerce-subscriptions');
             } else {
                 $switch_message = __('Choose a new subscription.', 'woocommerce-subscriptions');
             }
             WC_Subscriptions::add_notice($switch_message, 'notice');
         }
     } elseif ((is_cart() || is_checkout()) && !is_order_received_page() && false !== ($cart_item = self::cart_contains_subscription_switch())) {
         if (!WC_Subscriptions_Manager::user_owns_subscription($cart_item['subscription_key'])) {
             WC_Subscriptions::add_notice(__('Your cart contained an invalid subscription switch request and has been emptied.', 'woocommerce-subscriptions'), 'error');
             $woocommerce->cart->empty_cart(true);
             wp_redirect($woocommerce->cart->get_cart_url());
             exit;
         } else {
             WC_Subscriptions::add_notice(__('Once sign up is complete, this will replace your existing subscription.', 'woocommerce-subscriptions'), 'notice');
         }
     } elseif (is_product() && ($product = get_product($post))) {
         // Automatically initiate the switch process for limited variable subscriptions
         if (($product->is_type(array('variable-subscription', 'subscription_variation')) || 0 !== $product->post->post_parent) && WC_Subscriptions_Product::is_subscription($product->id) && 'no' != $product->limit_subscriptions) {
             // is switching enabled for variable or variable_grouped
             $allow_switching = in_array(get_option(WC_Subscriptions_Admin::$option_prefix . '_allow_switching', 'no'), array('variable', 'variable_grouped')) ? true : false;
             if ($allow_switching) {
                 // Check if the user has an active subscription for this product, and if so, initiate the switch process
                 $subscriptions = WC_Subscriptions_Manager::get_users_subscriptions();
                 foreach ($subscriptions as $subscription_key => $subscription) {
                     if ($subscription['product_id'] == $product->id && 'active' == $subscription['status']) {
                         wp_redirect(add_query_arg('auto-switch', 'true', self::get_switch_link($subscription_key)));
                         exit;
                     }
                 }
             } else {
                 WC_Subscriptions::add_notice(__('You have already subscribed to this product and it is limited to one per customer. You can not purchase the product again.', 'woocommerce-subscriptions'), 'notice');
             }
         }
     }
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:51,代码来源:class-wc-subscriptions-switcher.php


示例11: course_link_from_order

 /**
  * Add course link to order thank you and details pages.
  *
  * @since  1.4.5
  * @access public
  *
  * @return void
  */
 public static function course_link_from_order()
 {
     if (!is_order_received_page()) {
         return;
     }
     $order_id = get_query_var('order-received');
     $order = new WC_Order($order_id);
     // exit early if not wc-completed or wc-processing
     if ('wc-completed' != $order->post_status && 'wc-processing' != $order->post_status) {
         return;
     }
     $course_links = array();
     // store the for links for courses purchased
     foreach ($order->get_items() as $item) {
         if (isset($item['variation_id']) && 0 < $item['variation_id']) {
             // If item has variation_id then its a variation of the product
             $item_id = $item['variation_id'];
         } else {
             //If not its real product set its id to item_id
             $item_id = $item['product_id'];
         }
         // End If Statement
         $user_id = get_post_meta($order->id, '_customer_user', true);
         if ($user_id) {
             // Get all courses for product
             $args = Sensei_Course::get_default_query_args();
             $args['meta_query'] = array(array('key' => '_course_woocommerce_product', 'value' => $item_id));
             $args['orderby'] = 'menu_order date';
             $args['order'] = 'ASC';
             // loop through courses
             $courses = get_posts($args);
             if ($courses && count($courses) > 0) {
                 foreach ($courses as $course) {
                     $title = $course->post_title;
                     $permalink = get_permalink($course->ID);
                     $course_links[] .= '<a href="' . esc_url($permalink) . '" >' . $title . '</a> ';
                 }
                 // end for each
                 // close the message div
             }
             // end if $courses check
         }
     }
     // end loop through orders
     // add the courses to the WooCommerce notice
     if (!empty($course_links)) {
         $courses_html = _nx('You have purchased the following course:', 'You have purchased the following courses:', count($course_links), 'Purchase thank you note on Checkout page. The course link(s) will be show', 'woothemes-sensei');
         foreach ($course_links as $link) {
             $courses_html .= '<li>' . $link . '</li>';
         }
         $courses_html .= ' </ul>';
         wc_add_notice($courses_html, 'success');
     }
 }
开发者ID:pra85,项目名称:sensei,代码行数:62,代码来源:class-sensei-wc.php


示例12: ee_settings

    /**
     * Enhanced Ecommerce GA plugin Settings 
     *
     * @access public
     * @return void
     */
    function ee_settings()
    {
        global $woocommerce;
        //common validation----start
        if (is_admin() || current_user_can("manage_options") || $this->ga_ST == "no") {
            return;
        }
        $tracking_id = $this->ga_id;
        if (!$tracking_id) {
            return;
        }
        //common validation----end
        if (!empty($this->ga_Dname)) {
            $set_domain_name = esc_js($this->ga_Dname);
        } else {
            $set_domain_name = "auto";
        }
        //add display features
        if ($this->ga_DF) {
            $ga_display_feature_code = 'ga("require", "displayfeatures");';
        } else {
            $ga_display_feature_code = "";
        }
        $code = '        
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,"script","//www.google-analytics.com/analytics.js","ga");
                        ga("create", "' . esc_js($tracking_id) . '", "' . $set_domain_name . '");
                        ' . $ga_display_feature_code . '
                      
                        ga("send", "pageview");';
        //include this on all pages except order confirmation page.
        if (!is_order_received_page()) {
            echo "<script>" . $code . "</script>";
        }
    }
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:43,代码来源:class-wc-enhanced-ecommerce-google-analytics-integration.php


示例13: fb_tracking_pixel

    /**
     * Print the tracking pixel to wp_head
     */
    public function fb_tracking_pixel()
    {
        // only show the pixel if a tracking ID is defined
        if (!$this->fbid) {
            return;
        }
        ?>
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', '<?php 
        echo esc_html($this->fbid);
        ?>
');
fbq('track', 'PageView');

<?php 
        if (is_singular('product') && $this->event_viewcontent) {
            global $post;
            $product = wc_get_product($post->ID);
            $params = array();
            $params['content_name'] = $product->get_title();
            $params['content_ids'] = array($product->get_sku() ? $product->get_sku() : $product->id);
            $params['content_type'] = 'product';
            $params['value'] = floatval($product->get_price());
            $params['currency'] = get_woocommerce_currency();
            ?>
fbq('track', 'ViewContent', <?php 
            echo json_encode($params);
            ?>
);
<?php 
        }
        ?>

<?php 
        if (is_order_received_page() && $this->event_purchase) {
            global $wp;
            $params = array();
            $order_id = isset($wp->query_vars['order-received']) ? $wp->query_vars['order-received'] : 0;
            if ($order_id) {
                $params['order_id'] = $order_id;
                $order = new WC_Order($order_id);
                if ($order->get_items()) {
                    $productids = array();
                    foreach ($order->get_items() as $item) {
                        $product = $order->get_product_from_item($item);
                        $productids[] = $product->get_sku() ? $product->get_sku() : $product->id;
                    }
                    $params['content_ids'] = $productids;
                }
                $params['content_type'] = 'product';
                $params['value'] = $order->get_total();
                $params['currency'] = get_woocommerce_currency();
            }
            ?>
fbq('track', 'Purchase', <?php 
            echo json_encode($params);
            ?>
);

<?php 
        } elseif (is_checkout() && $this->event_checkout) {
            // get $cart to params
            $cart = WC()->cart->get_cart();
            $productids = array();
            foreach ($cart as $id => $item) {
                $product_id = $item['variation_id'] ? $item['variation_id'] : $item['product_id'];
                $product = new WC_Product($product_id);
                $productids[] = $product->get_sku() ? $product->get_sku() : $product->id;
            }
            $params = array();
            $params['num_items'] = WC()->cart->cart_contents_count;
            $params['value'] = WC()->cart->total;
            $params['currency'] = get_woocommerce_currency();
            $params['content_ids'] = $productids;
            ?>
fbq('track', 'InitiateCheckout', <?php 
            echo json_encode($params);
            ?>
);
<?php 
        }
        ?>


</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=<?php 
        echo esc_html($this->fbid);
        ?>
&ev=PageView&noscript=1"
//.........这里部分代码省略.........
开发者ID:anttiviljami,项目名称:woocommerce-facebook-conversion-pixel,代码行数:101,代码来源:class-wc-integration-fb-conversion-pixel.php


示例14: is_woocommerce_page

 function is_woocommerce_page()
 {
     return is_cart() || is_checkout() || is_account_page() || is_order_received_page() || is_product_category() || is_product_tag() || is_product() ? true : false;
 }
开发者ID:baden03,项目名称:access48,代码行数:4,代码来源:functions.php


示例15: dh_get_post_meta

function dh_get_post_meta($meta = '', $post_id = '', $default = null)
{
    $post_id = empty($post_id) ? get_the_ID() : $post_id;
    if (defined('WOOCOMMERCE_VERSION')) {
        if (is_shop()) {
            $post_id = wc_get_page_id('shop');
        } elseif (is_cart()) {
            $post_id = wc_get_page_id('cart');
        } elseif (is_checkout()) {
            $post_id = wc_get_page_id('checkout');
        } elseif (is_account_page()) {
            $post_id = wc_get_page_id('myaccount');
        } elseif (is_order_received_page()) {
            $post_id = wc_get_page_id('checkout');
        } elseif (is_add_payment_method_page()) {
            $post_id = wc_get_page_id('myaccount');
        }
    }
    if (is_search()) {
        $post_id = 0;
    }
    if (empty($meta)) {
        return false;
    }
    $value = get_post_meta($post_id, '_dh_' . $meta, true);
    if ($value !== '' && $value !== null && $value !== array() && $value !== false) {
        return apply_filters('dh_get_post_meta', $value, $meta, $post_id);
    }
    return $default;
}
开发者ID:mysia84,项目名称:mnassalska,代码行数:30,代码来源:functions.php


示例16: tbz_wc_voguepay_message

 function tbz_wc_voguepay_message()
 {
     if (get_query_var('order-received')) {
         $order_id = absint(get_query_var('order-received'));
         $order = wc_get_order($order_id);
         $payment_method = $order->payment_method;
         if (is_order_received_page() && 'tbz_voguepay_gateway' == $payment_method) {
             $voguepay_message = get_post_meta($order_id, '_tbz_voguepay_message', true);
             if (!empty($voguepay_message)) {
                 $message = $voguepay_message['message'];
                 $message_type = $voguepay_message['message_type'];
                 delete_post_meta($order_id, '_tbz_voguepay_message');
                 wc_add_notice($message, $message_type);
             }
         }
     }
 }
开发者ID:seyisulu,项目名称:voguepay-woocommerce-payment-gateway,代码行数:17,代码来源:voguepay-woocommerce-payment-gateway.php


示例17: inicis_order_received_title

 public function inicis_order_received_title($title, $id)
 {
     if (is_order_received_page() && get_the_ID() === $id) {
         global $wp;
         $order_id = apply_filters('woocommerce_thankyou_order_id', absint($wp->query_vars['order-received']));
         $order_key = apply_filters('woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key']));
         if (!empty($order_id)) {
             $order = new WC_Order($order_id);
             if ($order->get_status() == 'failed') {
                 $title = __('결제 실패로, 결제를 다시한번 진행 해 주시기 바랍니다.', 'inicis_payment');
             } else {
                 $title = __('정상적인 결제완료로 주문이 접수되었습니다.', 'inicis_payment');
             }
         } else {
             $title = __('정상적인 결제완료로 주문이 접수되었습니다.', 'inicis_payment');
         }
     }
     return $title;
 }
开发者ID:ksw2342,项目名称:kau_webstudio_12,代码行数:19,代码来源:inicis-for-woocommerce.php


示例18: wp_head

wp_head();
?>
</head>
<?php 
$class_name = 'header--sticky';
if (wpgrade::option('nav_always_show')) {
    $class_name .= '  nav-scroll-show';
} else {
    $class_name .= '  nav-scroll-hide';
}
$data_smoothscrolling = wpgrade::option('use_smooth_scroll') == 1 ? 'data-smoothscrolling' : '';
$data_main_color = wpgrade::option('main_color') ? 'data-color="' . wpgrade::option('main_color') . '"' : '';
//first let's test if we are in woocommerce
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
    //we need to setup post data
    if (is_shop() || is_cart() || is_checkout() || is_checkout_pay_page() || is_account_page() || is_order_received_page()) {
        $shop_page_id = wc_get_page_id('shop');
        if (!empty($shop_page_id) && $shop_page_id != 0) {
            global $post;
            $post = get_post($shop_page_id);
            setup_postdata($post);
            $make_transparent_menu_bar = get_post_meta(wpgrade::lang_page_id(get_the_ID()), wpgrade::prefix() . 'header_transparent_menu_bar', true);
            if ($make_transparent_menu_bar == 'on') {
                $class_name .= '  header--transparent';
            }
        }
    }
}
//make the header menu bar transparent
//only for static pages
if (is_page()) {
开发者ID:andreilupu,项目名称:jassyro-rosa-child-theme,代码行数:31,代码来源:header.php


示例19: wp_head

 /**
  * Add body classes.
  *
  * @access public
  * @return void
  */
 public function wp_head()
 {
     if (is_woocommerce()) {
         $this->add_body_class('woocommerce');
         $this->add_body_class('woocommerce-page');
         return;
     }
     if (is_checkout() || is_order_received_page()) {
         $this->add_body_class('woocommerce-checkout');
         $this->add_body_class('woocommerce-page');
         return;
     }
     if (is_cart()) {
         $this->add_body_class('woocommerce-cart');
         $this->add_body_class('woocommerce-page');
         return;
     }
     if (is_account_page()) {
         $this->add_body_class('woocommerce-account');
         $this->add_body_class('woocommerce-page');
         return;
     }
 }
开发者ID:shahadat014,项目名称:geleyi,代码行数:29,代码来源:woocommerce.php


示例20: title_config

 /**
  * Returns correct title for WooCommerce pages.
  *
  * @since 2.0.0
  */
 public static function title_config($title)
 {
     // Shop title
     if (is_shop()) {
         $title = get_the_title(wc_get_page_id('shop'));
         $title = $title ? $title : ($title = esc_html__('Shop', 'total'));
     } elseif (is_product()) {
         $title = wpex_get_translated_theme_mod('woo_shop_single_title');
         $title = $title ? $title : esc_html__('Shop', 'total');
     } elseif (is_order_received_page()) {
         $title = esc_html__('Order Received', 'total');
     }
     // Return title
     return $title;
 }
开发者ID:iq007,项目名称:MadScape,代码行数:20,代码来源:woocommerce-config.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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