function product_cat($atts, $content = null)
{
    global $wpdb;
    if (!class_exists('WP_eCommerce') && !class_exists('Woocommerce')) {
        return false;
    }
    extract(shortcode_atts(array('image_width' => 220, 'image_height' => 220, 'limit' => 20, 'cat' => '0', 'title' => __('Product category', ETHEME_DOMAIN)), $atts));
    $key = '_etheme_new_label';
    $post_type = 'wpsc-product';
    if (class_exists('Woocommerce')) {
        $args = apply_filters('woocommerce_related_products_args', array('post_type' => 'product', 'no_found_rows' => 1, 'product_cat' => $cat, 'posts_per_page' => $limit));
    }
    ob_start();
    etheme_create_slider($args, $title);
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
function etheme_new_shortcodes($atts, $content = null)
{
    global $wpdb;
    if (!class_exists('WP_eCommerce') && !class_exists('Woocommerce')) {
        return false;
    }
    extract(shortcode_atts(array('image_width' => 215, 'image_height' => 215, 'limit' => 50, 'title' => __('New Products', ETHEME_DOMAIN)), $atts));
    $key = '_etheme_new_label';
    $post_type = 'wpsc-product';
    if (class_exists('Woocommerce')) {
        $args = apply_filters('woocommerce_related_products_args', array('post_type' => 'product', 'meta_key' => $key, 'meta_value' => 1, 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $limit));
    }
    if (class_exists('WP_eCommerce')) {
        $args = array('post_type' => 'wpsc-product', 'meta_key' => $key, 'meta_value' => 1, 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => 20, 'orderby' => $orderby);
    }
    ob_start();
    etheme_create_slider($args, $title, $image_width, $image_height);
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemple #3
0
<?php

/**
 * Single Product Up-Sells
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $product, $woocommerce, $woocommerce_loop;
$upsells = $product->get_upsells();
if (sizeof($upsells) == 0) {
    return;
}
$meta_query = $woocommerce->query->get_meta_query();
$args = array('post_type' => 'product', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'post__in' => $upsells, 'post__not_in' => array($product->id), 'meta_query' => $meta_query);
$sidebar_slider = false;
if (etheme_get_option('upsell_location') == 'sidebar') {
    etheme_create_flex_slider($args, __('Our offers', ETHEME_DOMAIN), false, true);
} else {
    $slider_args = array('title' => __('Our offers', ETHEME_DOMAIN));
    etheme_create_slider($args, $slider_args);
}
wp_reset_postdata();
Exemple #4
0
function etheme_new_shortcodes($atts, $content = null)
{
    global $wpdb;
    if (!class_exists('Woocommerce')) {
        return false;
    }
    extract(shortcode_atts(array('shop_link' => 1, 'limit' => 50, 'categories' => '', 'title' => __('Latest Products', ETHEME_DOMAIN)), $atts));
    $key = 'product_new';
    if (!class_exists('Woocommerce')) {
        return;
    }
    $args = array('post_type' => 'product', 'meta_key' => $key, 'meta_value' => 'enable', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $limit);
    // Narrow by categories
    if ($categories != '') {
        $categories = explode(",", $categories);
        $gc = array();
        foreach ($categories as $grid_cat) {
            array_push($gc, $grid_cat);
        }
        $gc = implode(",", $gc);
        ////http://snipplr.com/view/17434/wordpress-get-category-slug/
        $args['category_name'] = $gc;
        $pt = array('product');
        $taxonomies = get_taxonomies('', 'object');
        $args['tax_query'] = array('relation' => 'OR');
        foreach ($taxonomies as $t) {
            if (in_array($t->object_type[0], $pt)) {
                $args['tax_query'][] = array('taxonomy' => $t->name, 'terms' => $categories, 'field' => 'id');
            }
        }
    }
    ob_start();
    etheme_create_slider($args, $title, $shop_link);
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemple #5
0
 /** @see WP_Widget */
 function widget($args = array(), $instance = array())
 {
     global $woocommerce, $wpdb;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Special Offers', ETHEME_DOMAIN) : $instance['title'], $instance, $this->id_base);
     $hide_if_empty = empty($instance['hide_if_empty']) ? 0 : 1;
     $key = '_etheme_special';
     $args = apply_filters('woocommerce_related_products_args', array('post_type' => 'product', 'meta_key' => $key, 'meta_value' => true, 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $instance['number']));
     ob_start();
     etheme_create_slider($args, $title, $image_width, $image_height, false, 1, 0);
     $output = ob_get_contents();
     ob_end_clean();
     ?>
 <div class="widget-container widget_special_offers">
     <?php 
     echo $output;
     ?>
 </div>
 
     <?php 
 }