Example #1
0
function flexmarket_list_products($unique_id = '', $context = '')
{
    $btnclass = mpt_load_mp_btn_color();
    $iconclass = mpt_load_whiteicon_in_btn();
    $tagcolor = mpt_load_icontag_color();
    $span = mpt_load_product_listing_layout();
    $counter = mpt_load_product_listing_counter();
    $entries = get_option('mpt_mp_listing_entries');
    $advancedsoft = mpt_enable_advanced_sort();
    $advancedsoftbtnposition = mpt_advanced_sort_btn_position();
    echo flexmarket_advance_product_sort($unique_id, $advancedsoft, $advancedsoftbtnposition, $context, false, true, '', $entries, '', '', '', '', $counter, $span, $btnclass, $iconclass, $tagcolor);
}
    function block($instance)
    {
        extract($instance);
        //setup taxonomy if applicable
        if ($taxonomy_type == 'category') {
            $taxonomy_category = esc_attr($taxonomy);
            $taxonomy_tag = '';
            $context = $taxonomy_type;
        } else {
            if ($taxonomy_type == 'tag') {
                $taxonomy_tag = esc_attr($taxonomy);
                $taxonomy_category = '';
                $context = $taxonomy_type;
            } else {
                $taxonomy_category = '';
                $taxonomy_tag = '';
                $context = 'list';
            }
        }
        switch ($btncolor) {
            case 'grey':
                $btnclass = '';
                $iconclass = '';
                break;
            case 'blue':
                $btnclass = ' btn-primary';
                $iconclass = ' icon-white';
                break;
            case 'lightblue':
                $btnclass = ' btn-info';
                $iconclass = ' icon-white';
                break;
            case 'green':
                $btnclass = ' btn-success';
                $iconclass = ' icon-white';
                break;
            case 'yellow':
                $btnclass = ' btn-warning';
                $iconclass = ' icon-white';
                break;
            case 'red':
                $btnclass = ' btn-danger';
                $iconclass = ' icon-white';
                break;
            case 'black':
                $btnclass = ' btn-inverse';
                $iconclass = ' icon-white';
                break;
        }
        switch ($iconcolor) {
            case 'blue':
                $tagcolor = ' icon-blue';
                break;
            case 'lightblue':
                $tagcolor = ' icon-lightblue';
                break;
            case 'green':
                $tagcolor = ' icon-green';
                break;
            case 'yellow':
                $tagcolor = ' icon-yellow';
                break;
            case 'red':
                $tagcolor = ' icon-red';
                break;
            case 'white':
                $tagcolor = ' icon-white';
                break;
            case 'black':
                $tagcolor = '';
                break;
        }
        switch ($layout) {
            case '2col':
                $span = 'span6';
                $counter = '2';
                break;
            case '3col':
                $span = 'span4';
                $counter = '3';
                break;
            case '4col':
                $span = 'span3';
                $counter = '4';
                break;
            default:
                $span = 'span4';
                $counter = '3';
                break;
        }
        ?>

		<?php 
        if ($showcategory == 'yes') {
            ?>

			<ul class="mpt-product-categories <?php 
            echo $align;
            ?>
">
				<li>By Category: </li>
				<li id="all">All</li>
				<?php 
            $args = array('taxonomy' => 'product_category', 'orderby' => 'name', 'order' => 'ASC');
            $categories = get_categories($args);
            if ($categories) {
                foreach ($categories as $category) {
                    echo '<li id="' . $category->slug . '">' . $category->name . '</li>';
                }
            }
            ?>
			</ul>

			<div class="clear padding15"></div>

		<?php 
        }
        ?>

		<?php 
        flexmarket_advance_product_sort($block_id, $showcategory == 'advsoft' ? true : false, $align, $context, true, 'nopagingblock', '', $entries, $order_by, $arrange, $taxonomy_category, $taxonomy_tag, $counter, $span, $btnclass, $iconclass, $tagcolor, 'thetermsclass', ' style="background: ' . esc_attr($bgcolor) . '; color: ' . esc_attr($textcolor) . ';"');
        ?>

	<?php 
    }