Beispiel #1
0
function fflcommerce_product_tag($attributes)
{
    global $paged;
    $fflcommerce_options = FFLCommerce_Base::get_options();
    $attributes = shortcode_atts(array('tag' => '', 'per_page' => $fflcommerce_options->get('fflcommerce_catalog_per_page'), 'columns' => $fflcommerce_options->get('fflcommerce_catalog_columns'), 'orderby' => $fflcommerce_options->get('fflcommerce_catalog_sort_orderby'), 'order' => $fflcommerce_options->get('fflcommerce_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes);
    if (isset($_REQUEST['tag'])) {
        $attributes['tag'] = $_REQUEST['tag'];
    }
    /** Operator validation. */
    if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) {
        $tax_operator = 'IN';
    }
    /** Multiple category values. */
    if (!empty($slug)) {
        $slug = explode(',', esc_attr($slug));
        $slug = array_map('trim', $slug);
    }
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator'])));
    query_posts($args);
    ob_start();
    fflcommerce_get_template_part('loop', 'shop');
    if ($attributes['pagination']) {
        do_action('fflcommerce_pagination');
    }
    wp_reset_query();
    return ob_get_clean();
}
Beispiel #2
0
function fflcommerce_sale_products($atts)
{
    global $columns, $per_page, $paged;
    extract(shortcode_atts(array('per_page' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_per_page'), 'columns' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_columns'), 'orderby' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_sort_orderby'), 'order' => FFLCommerce_Base::get_options()->get('fflcommerce_catalog_sort_direction'), 'pagination' => false), $atts));
    $ids = fflcommerce_product::get_product_ids_on_sale();
    if (empty($ids)) {
        $ids = array('0');
    }
    $args = array('post_status' => 'publish', 'post_type' => 'product', 'posts_per_page' => $per_page, 'orderby' => $orderby, 'order' => $order, 'paged' => $paged, 'post__in' => $ids);
    query_posts($args);
    ob_start();
    fflcommerce_get_template_part('loop', 'shop');
    if ($pagination) {
        do_action('fflcommerce_pagination');
    }
    wp_reset_postdata();
    return ob_get_clean();
}
 function fflcommerce_related_products($posts_per_page = 4, $post_columns = 4, $orderby = 'rand')
 {
     /** @var $_product fflcommerce_product */
     global $_product, $columns, $per_page;
     // Pass vars to loop
     $per_page = $posts_per_page;
     $columns = $post_columns;
     $related = $_product->get_related($posts_per_page);
     if (sizeof($related) > 0) {
         echo '<div class="related products"><h2>' . __('Related Products', 'fflcommerce') . '</h2>';
         $args = array('post_type' => 'product', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'orderby' => $orderby, 'post__in' => $related);
         $args = apply_filters('fflcommerce_related_products_args', $args);
         query_posts($args);
         fflcommerce_get_template_part('loop', 'shop');
         echo '</div>';
         wp_reset_query();
     }
     $per_page = null;
     // reset for cross sells if enabled
     $columns = null;
 }
	<?php 
}
?>

	<?php 
$shop_page_id = fflcommerce_get_page_id('shop');
$shop_page = get_post($shop_page_id);
if (post_password_required($shop_page)) {
    echo get_the_password_form($shop_page);
} else {
    echo apply_filters('the_content', $shop_page->post_content);
    ?>

	<?php 
    ob_start();
    fflcommerce_get_template_part('loop', 'shop');
    $products_list_html = ob_get_clean();
    echo apply_filters('fflcommerce_products_list', $products_list_html);
    ?>

	<?php 
    do_action('fflcommerce_pagination');
}
?>

<?php 
do_action('fflcommerce_after_main_content');
?>

<?php 
do_action('fflcommerce_sidebar');