Пример #1
0
        <div class="dropdown left dropdown-select">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="false" title="<?php 
echo __('View', 'venedor');
?>
">
                <?php 
echo $item_count;
?>
                <span class="arrow"></span>
            </a>
            <ul class="dropdown-menu">
                <?php 
for ($i = 0; $i < count($per_page); $i++) {
    if ($item_count != $per_page[$i]) {
        ?>
                        <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'count', $per_page[$i]);
        ?>
"><?php 
        echo $per_page[$i];
        ?>
</a></li>
                <?php 
    }
}
?>
            </ul>
        </div>
    </div>
</div>
Пример #2
0
function venedor_woocommerce_catalog_ordering()
{
    global $venedor_settings;
    parse_str($_SERVER['QUERY_STRING'], $params);
    $query_string = '?' . $_SERVER['QUERY_STRING'];
    // replace it with theme option
    if ($venedor_settings['category-item']) {
        $per_page = explode(',', $venedor_settings['category-item']);
    } else {
        $per_page = explode(',', '9,15,30');
    }
    $orderby = strtolower(!empty($params['orderby']) ? $params['orderby'] : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby')));
    if ($orderby == 'menu_order title' || $orderby == 'menu_order') {
        $orderby = 'default';
    }
    if ($orderby == 'title') {
        $orderby = 'name';
    }
    $order = strtoupper(!empty($params['order']) ? $params['order'] : ($orderby == 'rating' || $orderby == 'price-desc' ? 'DESC' : 'ASC'));
    if ($orderby == 'price-desc') {
        $orderby = 'price';
    }
    $item_count = !empty($params['count']) ? $params['count'] : $per_page[0];
    ?>
    <div class="toolbar clearfix">
        <div class="sorter clearfix">
            <div class="sort-by">
                <?php 
    // sort by
    ?>
                <label class="left"><?php 
    echo __('Sort By', 'venedor');
    ?>
: </label>
                <div class="dropdown left dropdown-select">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="false" title="<?php 
    echo __('Sort By', 'venedor');
    ?>
">
                        <?php 
    echo __(ucfirst($orderby), 'venedor');
    ?>
                        <span class="arrow"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <?php 
    if ($orderby != 'default') {
        ?>
                            <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'orderby', 'menu_order');
        ?>
"><?php 
        echo __('Default', 'venedor');
        ?>
</a></li>
                        <?php 
    }
    ?>
                        <?php 
    if ($orderby != 'popularity') {
        ?>
                            <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'orderby', 'popularity');
        ?>
"><?php 
        echo __('Popularity', 'venedor');
        ?>
</a></li>
                        <?php 
    }
    ?>
                        <?php 
    if ($orderby != 'rating' && get_option('woocommerce_enable_review_rating') != 'no') {
        ?>
                            <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'orderby', 'rating');
        ?>
"><?php 
        echo __('Rating', 'venedor');
        ?>
</a></li>
                        <?php 
    }
    ?>
                        <?php 
    if ($orderby != 'date') {
        ?>
                            <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'orderby', 'date');
        ?>
"><?php 
        echo __('Date', 'venedor');
        ?>
</a></li>
                        <?php 
    }
    ?>
                        <?php 
    if ($orderby != 'price') {
        ?>
                            <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'orderby', 'price');
        ?>
"><?php 
        echo __('Price', 'venedor');
        ?>
</a></li>
                        <?php 
    }
    ?>
                        <?php 
    if ($orderby != 'name') {
        ?>
                            <li><a tabindex="-1" href="<?php 
        echo venedor_add_url_parameters($query_string, 'orderby', 'title');
        ?>
"><?php 
        echo __('Name', 'venedor');
        ?>
</a></li>
                        <?php 
    }
    ?>
                    </ul>
                </div>

                <?php 
    // order
    ?>
                <?php 
    if ($order == 'DESC') {
        ?>
                    <a class="btn-arrow order-desc" href="<?php 
        echo venedor_add_url_parameters($query_string, 'order', 'asc');
        ?>
"></a>
                <?php 
    } else {
        ?>
                    <a class="btn-arrow order-asc left" href="<?php 
        echo venedor_add_url_parameters($query_string, 'order', 'desc');
        ?>
"></a>
                <?php 
    }
    ?>
            </div>

            <div class="view-mode gridlist-toggle">
                <a href="#" id="grid" title="<?php 
    echo __('Grid View', 'venedor');
    ?>
"></a><a href="#" id="list" title="<?php 
    echo __('List View', 'venedor');
    ?>
"></a>
            </div>
        </div>

        <?php 
    // pager
    ?>
        <?php 
    woocommerce_pagination();
    ?>
    </div>
    <?php 
}