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


PHP woocommerce_get_template函数代码示例

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


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

示例1: simulator

 /**
  * Display the simulator.
  *
  * @return string Simulator HTML.
  */
 public static function simulator()
 {
     global $product;
     if (!is_product() || !self::$activated) {
         return;
     }
     if ($product->needs_shipping() && $product->is_in_stock() && in_array($product->product_type, array('simple', 'variable'))) {
         $options = get_option('woocommerce_correios_settings');
         if ('variable' == $product->product_type) {
             $style = 'display: none';
             $ids = array();
             foreach ($product->get_available_variations() as $variation) {
                 $_variation = get_product($variation['variation_id']);
                 $ids[] = $_variation->needs_shipping() ? $_variation->variation_id : '';
             }
             $ids = implode(',', array_filter($ids));
         } else {
             $style = '';
             $ids = $product->id;
         }
         if (isset($options['display_date']) && 'yes' == $options['display_date']) {
             $title = __('Shipping and delivery time', 'woocommerce-correios');
             $description = __('Calculate the shipping and delivery time estimated to your region.', 'woocommerce-correios');
         } else {
             $title = __('Shipping', 'woocommerce-correios');
             $description = __('Calculate shipping estimated to your region.', 'woocommerce-correios');
         }
         woocommerce_get_template('single-product/correios-simulator.php', array('product' => $product, 'style' => $style, 'ids' => $ids, 'title' => $title, 'description' => $description), '', WC_Correios::get_templates_path());
     }
 }
开发者ID:pensesmart,项目名称:woocommerce-correios,代码行数:35,代码来源:class-wc-correios-product-shipping-simulator.php

示例2: woocommerce_order_tracking

function woocommerce_order_tracking($atts)
{
    global $woocommerce;
    $woocommerce->nocache();
    extract(shortcode_atts(array(), $atts));
    global $post;
    if ($_POST) {
        $woocommerce->verify_nonce('order_tracking');
        if (isset($_POST['orderid']) && $_POST['orderid']) {
            $order_id = $_POST['orderid'];
        } else {
            $order_id = 0;
        }
        if (isset($_POST['order_email']) && $_POST['order_email']) {
            $order_email = trim($_POST['order_email']);
        } else {
            $order_email = '';
        }
        $order = new WC_Order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
        if ($order->id && $order_email) {
            if (strtolower($order->billing_email) == strtolower($order_email)) {
                woocommerce_get_template('order/tracking.php', array('order' => $order));
                return;
            }
        }
        echo '<p>' . sprintf(__('Sorry, we could not find that order id in our database. <a href="%s">Want to retry?</a>', 'woocommerce'), get_permalink($post->ID)) . '</p>';
    } else {
        woocommerce_get_template('order/form-tracking.php');
    }
}
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:30,代码来源:shortcode-order_tracking.php

示例3: woocommerce_template_loop_add_to_cart

 function woocommerce_template_loop_add_to_cart()
 {
     if (!is_user_logged_in()) {
         return;
     }
     woocommerce_get_template('loop/add-to-cart.php');
 }
开发者ID:shahadat014,项目名称:geleyi,代码行数:7,代码来源:hide-price.php

示例4: woocommerce_auction_pay

 /**
  * Output the to pay block.
  *
  * @access public
  * @subpackage	Product
  * @return void
  * 
  */
 function woocommerce_auction_pay()
 {
     global $product;
     if ($product->product_type == 'auction') {
         woocommerce_get_template('single-product/pay.php');
     }
 }
开发者ID:Omuze,项目名称:barakat,代码行数:15,代码来源:woocommerce-simple-auctions-templating.php

示例5: my_bookings

 /**
  * Show a users bookings
  */
 public function my_bookings()
 {
     $bookings = WC_Bookings_Controller::get_bookings_for_user(get_current_user_id());
     if ($bookings) {
         woocommerce_get_template('myaccount/my-bookings.php', array('bookings' => $bookings), 'woocommerce-bookings/', WC_BOOKINGS_TEMPLATE_PATH);
     }
 }
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:10,代码来源:class-wc-bookings-orders.php

示例6: woocommerce_product_categories

/**
 * List all (or limited) product categories
 **/
function woocommerce_product_categories($atts)
{
    global $woocommerce_loop;
    extract(shortcode_atts(array('number' => null, 'orderby' => 'name', 'order' => 'ASC', 'columns' => '4', 'hide_empty' => 1), $atts));
    if (isset($atts['ids'])) {
        $ids = explode(',', $atts['ids']);
        $ids = array_map('trim', $ids);
    } else {
        $ids = array();
    }
    $hide_empty = $hide_empty == true || $hide_empty == 1 ? 1 : 0;
    $args = array('number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids);
    $terms = get_terms('product_cat', $args);
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    if ($product_categories) {
        echo '<ul class="products">';
        foreach ($product_categories as $category) {
            woocommerce_get_template('content-product_cat.php', array('category' => $category));
        }
        echo '</ul>';
    }
    wp_reset_query();
    return ob_get_clean();
}
开发者ID:eddiewilson,项目名称:new-ke,代码行数:28,代码来源:shortcode-init.php

示例7: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     // Check checkout is configured correctly
     if (current_user_can('manage_options')) {
         $pay_page_id = woocommerce_get_page_id('pay');
         $thanks_page_id = woocommerce_get_page_id('thanks');
         $pay_page = get_permalink($pay_page_id);
         $thanks_page = get_permalink($thanks_page_id);
         if (!$pay_page_id || !$thanks_page_id || empty($pay_page) || empty($thanks_page)) {
             $woocommerce->add_error(sprintf(__('WooCommerce Config Error: The checkout thanks/pay pages are missing - these pages are required for the checkout to function correctly. Please configure the pages <a href="%s">here</a>.', 'woocommerce'), admin_url('admin.php?page=woocommerce_settings&tab=pages')));
         }
     }
     // Show non-cart errors
     $woocommerce->show_messages();
     // Check cart has contents
     if (sizeof($woocommerce->cart->get_cart()) == 0) {
         return;
     }
     // Calc totals
     $woocommerce->cart->calculate_totals();
     // Check cart contents for errors
     do_action('woocommerce_check_cart_items');
     // Get checkout object
     $checkout = $woocommerce->checkout();
     if (empty($_POST) && $woocommerce->error_count() > 0) {
         woocommerce_get_template('checkout/cart-errors.php', array('checkout' => $checkout));
     } else {
         $non_js_checkout = !empty($_POST['woocommerce_checkout_update_totals']) ? true : false;
         if ($woocommerce->error_count() == 0 && $non_js_checkout) {
             $woocommerce->add_message(__('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce'));
         }
         woocommerce_get_template('checkout/form-checkout.php', array('checkout' => $checkout));
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:42,代码来源:class-wc-shortcode-checkout.php

示例8: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     // Prevent cache
     $woocommerce->nocache();
     // Show non-cart errors
     $woocommerce->show_messages();
     // Check cart has contents
     if (sizeof($woocommerce->cart->get_cart()) == 0) {
         return;
     }
     // Calc totals
     $woocommerce->cart->calculate_totals();
     // Check cart contents for errors
     do_action('woocommerce_check_cart_items');
     // Get checkout object
     $checkout = $woocommerce->checkout();
     if (empty($_POST) && $woocommerce->error_count() > 0) {
         woocommerce_get_template('checkout/cart-errors.php', array('checkout' => $checkout));
     } else {
         $non_js_checkout = !empty($_POST['woocommerce_checkout_update_totals']) ? true : false;
         if ($woocommerce->error_count() == 0 && $non_js_checkout) {
             $woocommerce->add_message(__('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce'));
         }
         woocommerce_get_template('checkout/form-checkout.php', array('checkout' => $checkout));
     }
 }
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:34,代码来源:class-wc-shortcode-checkout.php

示例9: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     $woocommerce->nocache();
     extract(shortcode_atts(array(), $atts));
     global $post;
     if (!empty($_REQUEST['orderid'])) {
         $woocommerce->verify_nonce('order_tracking');
         $order_id = empty($_REQUEST['orderid']) ? 0 : esc_attr($_REQUEST['orderid']);
         $order_email = empty($_REQUEST['order_email']) ? '' : esc_attr($_REQUEST['order_email']);
         if (!$order_id) {
             echo '<p class="woocommerce-error">' . __('Please enter a valid order ID', 'woocommerce') . '</p>';
         } elseif (!$order_email) {
             echo '<p class="woocommerce-error">' . __('Please enter a valid order email', 'woocommerce') . '</p>';
         } else {
             $order = new WC_Order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
             if ($order->id && $order_email) {
                 if (strtolower($order->billing_email) == strtolower($order_email)) {
                     do_action('woocommerce_track_order', $order->id);
                     woocommerce_get_template('order/tracking.php', array('order' => $order));
                     return;
                 }
             } else {
                 echo '<p class="woocommerce-error">' . sprintf(__('Sorry, we could not find that order id in our database.', 'woocommerce'), get_permalink($post->ID)) . '</p>';
             }
         }
     }
     woocommerce_get_template('order/form-tracking.php');
 }
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:36,代码来源:class-wc-shortcode-order-tracking.php

示例10: woocommerce_thankyou

/**
 * Outputs the order received page
 **/
function woocommerce_thankyou($atts)
{
    global $woocommerce;
    $woocommerce->nocache();
    $woocommerce->show_messages();
    $order = false;
    // Pay for order after checkout step
    if (isset($_GET['order'])) {
        $order_id = $_GET['order'];
    } else {
        $order_id = 0;
    }
    if (isset($_GET['key'])) {
        $order_key = $_GET['key'];
    } else {
        $order_key = '';
    }
    // Empty awaiting payment session
    unset($_SESSION['order_awaiting_payment']);
    if ($order_id > 0) {
        $order = new WC_Order($order_id);
        if ($order->order_key != $order_key) {
            unset($order);
        }
    }
    woocommerce_get_template('checkout/thankyou.php', array('order' => $order));
}
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:30,代码来源:shortcode-thankyou.php

示例11: woocommerce_order_tracking

function woocommerce_order_tracking($atts)
{
    global $woocommerce, $order;
    extract(shortcode_atts(array(), $atts));
    global $post;
    if ($_POST) {
        $order =& new woocommerce_order();
        if (isset($_POST['orderid']) && $_POST['orderid'] > 0) {
            $order->id = (int) $_POST['orderid'];
        } else {
            $order->id = 0;
        }
        if (isset($_POST['order_email']) && $_POST['order_email']) {
            $order_email = trim($_POST['order_email']);
        } else {
            $order_email = '';
        }
        $woocommerce->verify_nonce('order_tracking');
        if ($order->id && $order_email && $order->get_order($order->id)) {
            if ($order->billing_email == $order_email) {
                woocommerce_get_template('order/tracking.php');
                return;
            }
        }
        echo '<p>' . sprintf(__('Sorry, we could not find that order id in our database. <a href="%s">Want to retry?</a>', 'woothemes'), get_permalink($post->ID)) . '</p>';
    } else {
        woocommerce_get_template('order/tracking-form.php');
    }
}
开发者ID:randyhoyt,项目名称:woocommerce,代码行数:29,代码来源:shortcode-order_tracking.php

示例12: add_to_cart

 /**
  * Add to cart for bookings
  */
 public function add_to_cart()
 {
     global $product;
     // Prepare form
     $booking_form = new WC_Booking_Form($product);
     // Get template
     woocommerce_get_template('single-product/add-to-cart/booking.php', array('booking_form' => $booking_form), 'woocommerce-bookings', WC_BOOKINGS_TEMPLATE_PATH);
 }
开发者ID:baperrou,项目名称:pedal-bookings,代码行数:11,代码来源:class-wc-booking-cart-manager.php

示例13: wc_get_template

 /**
  * @since 1.1.0 of SA_WC_Compatibility
  */
 public static function wc_get_template($template_path)
 {
     if (self::is_wc_21()) {
         return wc_get_template($template_path);
     } else {
         return woocommerce_get_template($template_path);
     }
 }
开发者ID:WP-Panda,项目名称:allergenics,代码行数:11,代码来源:class-wc-compatibility.php

示例14: show_product_thumbnails

 /**
  * Change product-thumbnails.php template
  * 
  * @access public
  * @return void
  * @since 1.0.0
  */
 public function show_product_thumbnails()
 {
     if (function_exists('wc_get_template')) {
         wc_get_template('single-product/product-thumbnails-magnifier.php', array(), '', YITH_WCMG_DIR . 'templates/');
     } else {
         woocommerce_get_template('single-product/product-thumbnails-magnifier.php', array(), '', YITH_WCMG_DIR . 'templates/');
     }
 }
开发者ID:zgomotos,项目名称:Bazar,代码行数:15,代码来源:class.yith-wcmg-frontend.php

示例15: output

 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     global $woocommerce;
     if (!is_user_logged_in()) {
         return;
     }
     woocommerce_get_template('myaccount/form-change-password.php');
 }
开发者ID:joshquila,项目名称:demo2-youse,代码行数:15,代码来源:class-wc-shortcode-change-password.php


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