Sorry for my bad english.
I have WP 3.3.1 & wp-e-commerce.3.8.7.6.2. On the products page (which use wpsc-products_page.php template) I have list of products. I want to group this products by category. For example:
**Cat1
Product 1
Product 2
** Cat2
Product 1
Product 2
** Cat3
Product 1
Product 2
I try to use this method, but it`s does not work
add_filter('posts_join', create_function('$a', 'global $wpdb; return $a . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";'));
add_filter('posts_where', create_function('$a', 'global $wpdb; return $a . " AND $wpdb->term_taxonomy.taxonomy = 'wpsc_product_category'";'));
add_filter('posts_orderby', create_function('$a','global $wpdb; return "$wpdb->term_taxonomy.term_id DESC";'));
query_posts('');
Thank you all in advance for your reply!
You are very close. I had the same problem a while ago, and blogged about it. Your join is missing one more join table, wp_terms, which has the term you want to sort on.
Here is the code I used:
Here you can find a solution : http://subharanjan.in/category-wise-products-display-in-wp-e-commerce/
I am not sure if this will solve your problem.
Thanks!