/**
  * Output memberships table in My Account
  *
  * @since 1.0.0
  */
 public function my_account_memberships()
 {
     $customer_memberships = wc_memberships_get_user_memberships();
     if (!empty($customer_memberships)) {
         wc_get_template('myaccount/my-memberships.php', array('customer_memberships' => $customer_memberships));
     }
 }
 public static function registrations_add_to_cart()
 {
     global $product;
     // Enqueue variation scripts
     wp_enqueue_script('wc-add-to-cart-variation');
     wc_get_template('single-product/add-to-cart/registration.php', array('available_variations' => $product->get_available_variations(), 'attributes' => $product->get_variation_attributes(), 'selected_attributes' => $product->get_variation_default_attributes()), '', plugin_dir_path(__FILE__) . 'templates/');
 }
コード例 #3
1
 /**
  * Shortcode view
  *
  * @return string
  */
 private function view()
 {
     ob_start();
     // load template file via WooCommerce template function
     wc_get_template('lost-license-form.php', array(), 'license-wp', license_wp()->service('file')->plugin_path() . '/templates/');
     return ob_get_clean();
 }
コード例 #4
1
 /**
  * Display saved cards
  */
 public function output()
 {
     if (!is_user_logged_in() || !($customer_id = get_user_meta(get_current_user_id(), '_stripe_customer_id', true)) || !is_string($customer_id)) {
         return;
     }
     $stripe = new WC_Gateway_Stripe();
     $cards = $stripe->get_saved_cards($customer_id);
     if ($cards) {
         wc_get_template('saved-cards.php', array('cards' => $cards), 'woocommerce-gateway-stripe/', WC_STRIPE_TEMPLATE_PATH);
     }
 }
コード例 #5
0
 /**
  * Output the shortcode.
  *
  * @param array $atts
  */
 public static function output($atts)
 {
     // Check cart class is loaded or abort
     if (is_null(WC()->cart)) {
         return;
     }
     extract(shortcode_atts(array(), $atts));
     global $post;
     if (!empty($_REQUEST['orderid']) && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'woocommerce-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 = wc_get_order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id));
             if ($order && $order->get_id() && $order_email) {
                 if (strtolower($order->get_billing_email()) == strtolower($order_email)) {
                     do_action('woocommerce_track_order', $order->get_id());
                     wc_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>';
             }
         }
     }
     wc_get_template('order/form-tracking.php');
 }
コード例 #6
0
 /**
  * Output widget.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array) explode('|', $_COOKIE['woocommerce_recently_viewed']) : array();
     $viewed_products = array_reverse(array_filter(array_map('absint', $viewed_products)));
     if (empty($viewed_products)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'post__in');
     if ('yes' === get_option('woocommerce_hide_out_of_stock_items')) {
         $query_args['tax_query'] = array(array('taxonomy' => 'product_visibility', 'field' => 'name', 'terms' => 'outofstock', 'operator' => 'NOT IN'));
     }
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">');
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php');
         }
         echo apply_filters('woocommerce_after_widget_product_list', '</ul>');
         $this->widget_end($args);
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
 }
コード例 #7
0
 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     if (function_exists('icl_register_string')) {
         icl_register_string('MediaCenter', 'Tab #1 title ' . $this->widget_id, $instance['title_tab_1']);
         icl_register_string('MediaCenter', 'Tab #2 title ' . $this->widget_id, $instance['title_tab_2']);
         icl_register_string('MediaCenter', 'Tab #3 title ' . $this->widget_id, $instance['title_tab_3']);
     }
     if (function_exists('icl_t')) {
         $instance['title_tab_1'] = icl_t('MediaCenter', 'Tab #1 title ' . $this->widget_id, $instance['title_tab_1']);
         $instance['title_tab_2'] = icl_t('MediaCenter', 'Tab #2 title ' . $this->widget_id, $instance['title_tab_2']);
         $instance['title_tab_3'] = icl_t('MediaCenter', 'Tab #3 title ' . $this->widget_id, $instance['title_tab_3']);
     }
     $vars['title_tab_1'] = apply_filters('widget_text', $instance['title_tab_1']);
     $sc_tab_1 = $instance['content_tab_1'];
     $vars['title_tab_2'] = apply_filters('widget_text', $instance['title_tab_2']);
     $sc_tab_2 = $instance['content_tab_2'];
     $vars['title_tab_3'] = apply_filters('widget_text', $instance['title_tab_3']);
     $sc_tab_3 = $instance['content_tab_3'];
     echo $before_widget;
     $vars['content_tab_1'] = do_shortcode('[' . $sc_tab_1 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
     $vars['content_tab_2'] = do_shortcode('[' . $sc_tab_2 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
     $vars['content_tab_3'] = do_shortcode('[' . $sc_tab_3 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
     echo wc_get_template('framework/templates/widgets/home-page-tabs.php', $vars);
     echo $after_widget;
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
コード例 #8
0
 /**
  * widget function.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  *
  * @return void
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product');
     $query_args['meta_query'] = WC()->query->get_meta_query();
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo '<ul class="product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => true));
         }
         echo '</ul>';
         $this->widget_end($args);
     }
     remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
コード例 #9
0
 /**
  * Show a users bookings
  */
 public function my_bookings()
 {
     $bookings = WC_Bookings_Controller::get_bookings_for_user(get_current_user_id());
     if ($bookings) {
         wc_get_template('myaccount/my-bookings.php', array('bookings' => $bookings), 'woocommerce-bookings/', WC_BOOKINGS_TEMPLATE_PATH);
     }
 }
 /**
  * Output the shortcode.
  *
  * @access public
  * @param array $atts
  * @return void
  */
 public static function output($atts)
 {
     if (!is_user_logged_in()) {
         return;
     }
     wc_get_template('myaccount/form-change-password.php');
 }
コード例 #11
0
 /**
  * Output widget.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => '_wc_average_rating', 'orderby' => 'meta_value_num', 'order' => 'DESC');
     $query_args['meta_query'] = WC()->query->get_meta_query();
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">');
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => true));
         }
         echo apply_filters('woocommerce_after_widget_product_list', '</ul>');
         $this->widget_end($args);
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
コード例 #12
0
function nm_ajax_add_to_cart_redirect_template()
{
    if (isset($_REQUEST['nm-ajax-add-to-cart'])) {
        wc_get_template('ajax-add-to-cart-fragments.php');
        exit;
    }
}
 /**
  * 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');
         }
         wc_get_template('single-product/correios-simulator.php', array('product' => $product, 'style' => $style, 'ids' => $ids, 'title' => $title, 'description' => $description), '', WC_Correios::get_templates_path());
     }
 }
コード例 #14
0
 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $number = absint($instance['number']);
     add_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product');
     $query_args['meta_query'] = WC()->query->get_meta_query();
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => true));
         }
         echo '</ul>';
         echo $after_widget;
     }
     remove_filter('posts_clauses', array(WC()->query, 'order_by_rating_post_clauses'));
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
コード例 #15
0
 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     global $comments, $comment, $woocommerce;
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $number = absint($instance['number']);
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'rand');
     $query_args['meta_query'] = array();
     $query_args['meta_query'][] = WC()->query->stock_status_meta_query();
     $query_args['meta_query'] = array_filter($query_args['meta_query']);
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php');
         }
         echo '</ul>';
         echo $after_widget;
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
 }
コード例 #16
0
 public function display_product_block()
 {
     global $post;
     $product = $GLOBALS['product'] = wc_get_product($post);
     $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'post');
     $image = $image[0];
     wc_get_template('single-product/introduction.php', compact('product', 'image'));
 }
 /**
  * Add a Template
  *
  * @return  void
  * @since 0.1.0
  */
 public function display_template()
 {
     global $product;
     // load up the scripts
     $this->load_scripts();
     // display the template
     wc_get_template('single-product/sample-template.php', array('product_id' => $product->id), FALSE, WC_Extension_Boilerplate::$dir . '/templates/');
 }
コード例 #18
0
ファイル: MyAccount.php プロジェクト: ChromeOrange/license-wp
 /**
  * Print licenses
  */
 public function print_licenses()
 {
     // get licenses of current user
     $licenses = license_wp()->service('license_manager')->get_licenses_by_user(get_current_user_id());
     if (count($licenses) > 0) {
         wc_get_template('my-licenses.php', array('licenses' => $licenses), 'license-wp', license_wp()->service('file')->plugin_path() . '/templates/');
     }
 }
コード例 #19
0
 /**
  * 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/');
     }
 }
コード例 #20
0
/**
 * Output the template part
 */
function wcdn_get_template_content($name, $args = null)
{
    global $wcdn;
    $location = $wcdn->print->get_template_file_location($name);
    if ($location) {
        wc_get_template($name, $args, $location, $location);
    }
}
コード例 #21
0
 /**
  * @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);
     }
 }
コード例 #22
0
 public function get_print_template()
 {
     // check for custom template
     $template_path_theme = '/woocommerce-pos/';
     $template_path_plugin = WC_POS()->plugin_path . 'public/views/print/';
     wc_get_template($_REQUEST['template'] . '.php', null, $template_path_theme, $template_path_plugin);
     die;
 }
コード例 #23
0
/**
 *  Preview Your WooCommerce Emails Live
 *  Heavily borrowed from drrobotnik:
 *  http://stackoverflow.com/a/27072101/2203639
 **/
function wordimpress_preview_woo_emails()
{
    if (is_admin()) {
        $default_path = WC()->plugin_path() . '/templates/';
        $files = scandir($default_path . 'emails');
        $exclude = array('.', '..', 'email-header.php', 'email-footer.php', 'email-styles.php', 'email-order-items.php', 'email-addresses.php', 'plain');
        $list = array_diff($files, $exclude);
        ?>
		<div id="template-selector">
			<a href="https://wordimpress.com" target="_blank" class="logo"><img src="<?php 
        echo get_stylesheet_directory_uri();
        ?>
/woocommerce/emails/img/wordimpress-icon.png">

				<p>Impressive Plugins, Themes, and more tutorials like this one.<br /><strong>"Here's to Building the Web!"</strong>
				</p></a>

			<form method="get" action="<?php 
        echo site_url();
        ?>
/wp-admin/admin-ajax.php">
				<div class="template-row">
					<input id="setorder" type="hidden" name="order" value="">
					<input type="hidden" name="action" value="previewemail">
					<span class="choose-email">Choose your email template: </span>
					<select name="file" id="email-select">
						<?php 
        foreach ($list as $item) {
            ?>
							<option value="<?php 
            echo $item;
            ?>
"><?php 
            echo str_replace('.php', '', $item);
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</div>
				<div class="order-row">
					<span class="choose-order">Choose an order number: </span>
					<input id="order" type="number" value="102" placeholder="102" onChange="process1(this)">
				</div>
				<input type="submit" value="Go">
			</form>
		</div>
		<?php 
        global $order;
        $order = new WC_Order($_GET['order']);
        wc_get_template('emails/email-header.php', array('order' => $order, 'email_heading' => $email_heading));
        do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text);
        wc_get_template('emails/' . $_GET['file'], array('order' => $order));
        wc_get_template('emails/email-footer.php', array('order' => $order));
    }
}
コード例 #24
0
 /**
  * Get Timeline Template
  *
  * It's possible to overwrite the template from theme.
  * Put your custom template in woocommerce/product-vendors folder
  *
  * @param        $filename  The filename
  * @param array  $args      The template args
  *
  * @use  wc_get_template()
  * @since    1.0
  * @return void
  */
 function yith_wcms_checkout_timeline($filename, $args)
 {
     $filename = apply_filters('yith_wcms_checkout_timeline_template', $filename);
     $section = 'woocommerce/checkout';
     $template_name = $section . '/' . $filename;
     $template_path = WC()->template_path() . 'multi-step/';
     $default_path = YITH_WCMS_TEMPLATE_PATH;
     wc_get_template($template_name, $args, $template_path, $default_path);
 }
コード例 #25
0
 /**
  * widget function.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  *
  * @return void
  */
 function widget($args, $instance)
 {
     $this->widget_start($args, $instance);
     ob_start();
     do_action('pre_get_auction_search_form');
     wc_get_template('auction-searchform.php');
     $form = apply_filters('get_auction_search_form', ob_get_clean());
     echo $form;
     $this->widget_end($args);
 }
 /**
  * Display saved cards
  */
 public function output()
 {
     if (!is_user_logged_in()) {
         return;
     }
     $cards = get_user_meta(get_current_user_id(), '_stripe_customer_id', false);
     if ($cards) {
         wc_get_template('saved-cards.php', array('cards' => $cards), 'woocommerce-gateway-stripe/', WC_STRIPE_TEMPLATE_PATH);
     }
 }
コード例 #27
0
 public static function small_business_info($atts)
 {
     $return = '';
     if (get_option('woocommerce_gzd_small_enterprise') == 'yes') {
         ob_start();
         wc_get_template('global/small-business-info.php');
         $return = ob_get_clean();
     }
     return apply_filters('woocommerce_gzdp_shortcode_small_enterprise_data', $return, $atts);
 }
コード例 #28
0
ファイル: Email.php プロジェクト: ChromeOrange/license-wp
 /**
  * @return string
  */
 public function get_content()
 {
     // load template file into content if still empty
     if (empty($this->content)) {
         ob_start();
         wc_get_template($this->template, $this->args, 'license-wp', license_wp()->service('file')->plugin_path() . '/templates/');
         $this->content = ob_get_clean();
     }
     return $this->content;
 }
コード例 #29
0
ファイル: compare.php プロジェクト: Qualitair/ecommerce
function media_center_product_comparison()
{
    ob_start();
    if (class_exists('YITH_Woocompare_Frontend')) {
        global $yith_woocompare;
        wc_get_template('compare.php', array('products' => $yith_woocompare->obj->get_products_list(), 'fields' => $yith_woocompare->obj->fields(), 'repeat_price' => get_option('yith_woocompare_price_end'), 'repeat_add_to_cart' => get_option('yith_woocompare_add_to_cart_end')));
    } else {
        echo '<p class="alert alert-danger">' . __('You need to enable YITH Compare plugin for product comparison to work', 'media_center') . '</p>';
    }
    return ob_get_clean();
}
コード例 #30
-1
 /**
  * Output widget.
  *
  * @see WP_Widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array) explode('|', $_COOKIE['woocommerce_recently_viewed']) : array();
     $viewed_products = array_reverse(array_filter(array_map('absint', $viewed_products)));
     if (empty($viewed_products)) {
         return;
     }
     ob_start();
     $number = !empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std'];
     $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'post__in');
     $query_args['meta_query'] = array();
     $query_args['meta_query'][] = WC()->query->stock_status_meta_query();
     $query_args['meta_query'] = array_filter($query_args['meta_query']);
     $r = new WP_Query($query_args);
     if ($r->have_posts()) {
         $this->widget_start($args, $instance);
         echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">');
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php');
         }
         echo apply_filters('woocommerce_after_widget_product_list', '</ul>');
         $this->widget_end($args);
     }
     wp_reset_postdata();
     $content = ob_get_clean();
     echo $content;
 }