0

Using the http://jigoshop.com/ plugin, is it possible to change the order in which the products are displayed in the different grids.

I'm not quite sure how it decides the order but is it possible to change it to sort it via menu order?

This is the page I'm working on - http://www.roadsafetyforchildren.co.uk/product-category/roadmaster-sets/ (I've yet to check browser compatibility with the site - I'm using Chrome)

1
  • maybe it is currently list by date of products? can you check this? But i think, the forum of the plugin is an better place for ask this question
    – bueltge
    Commented Aug 22, 2011 at 13:03

5 Answers 5

2

As Bainternet said you need to adjust the query vars, however I needed to change the order well before 'jigoshop_before_shop_loop' hook to get this to work. This function fires at pre_get_posts and orders by title.

    add_action('pre_get_posts', 'my_custom_query');
    function my_custom_query($wp_query){
        if(is_tax('product_cat')){

            $wp_query->query['order'] = 'ASC';
            $wp_query->query['orderby'] = 'title';

            return $wp_query;
        }
    }
1

I know this is an old question, but none of the above worked for me. On my product pages I wanted to sort by a meta field containing the product's release date. I ended up adding a new filter to the relevant Jigoshop filter hook, overriding the standard Jigoshop filter by giving mine a higher priority. Adding this to functions.php did the trick:

add_filter( 'loop-shop-query', create_function( '', 'return array("meta_key" => "release_date", "orderby" => "meta_value_num", "order" => "desc");' ), 999 );
0

Jigoshop has a lot of filter hooks that if you use them right you can do anything you want (almost), In your case you can use jigoshop_before_shop_loop action hook to call a function that will check if a the current call is from a taxonomy page (category products) and if so check if its a specific category you want to reorder, and if that is the case set the oderby parameter

add_filter('jigoshop_before_shop_loop','my_item_order');
function my_item_order(){
    global $columns, $post, $per_page, $wp_query;
    if (is_tax()){
        $term = get_term_by( 'slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']);
        if ($term->ID == 'YOUR_ID'){
            $wp_query->query['order_by'] = 'whatever'
        }
    }
}
0

Jigoshop orders products the same as Wordpress orders its posts. In order to give your products a specific order you can either do what Bainternet suggests, or you can just modify the publish dates to suit the order you desire.

0

@patnz's answer ALMOST worked for me. I had to set the "query_vars" array instead of a "query" one. Not sure if this is due to a typo on that answer's part or maybe WP versions.

I also used add_filter instead of add_action and moved the return $wp_query line down.

Here is my code which worked to sort a taxonomy archive page by title.

/*
    Change ordering on category pages
*/
function my_product_ordering($wp_query)
{           
    if(is_tax(array('product_cat')))
    {
        $wp_query->query_vars['order'] = 'ASC';
        $wp_query->query_vars['orderby'] = 'title'; 
    }

    return $wp_query;
}
add_filter('pre_get_posts', 'my_product_ordering');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.