WPSC how do i output product per category on one page (wpsc-product-page)

I am trying to output and sort products per category, like:

Cat1
prod
prod

Cat2 
prod

Cat3
prod
prod
prod

I am able to get the cat_ID per product, but how do i display

?php while (wpsc_have_products()) :  wpsc_the_product(); ?
    ?php

        $wpsc_product_category = get_the_product_category( wpsc_the_product_id() );
        $curr_cat = $wpsc_product_category[0]-name;
        $cat_id = $wpsc_product_category[0]-cat_ID;
        //print_r( $wpsc_product_category);
        echo $cat_id;

    ?

Any tips, suggestions?

Topic plugin-wp-e-commerce Wordpress

Category Web


You need to do 2 queries, 1 for the terms (using get_terms) and then a post query, an example is:

$taxonomy = 'portfolio_types';
$tax_terms = get_terms($taxonomy);
foreach ($tax_terms as $tax_term) {
 echo '<li>' . '<a href="#'.$tax_term->slug.'"' . '>' . $tax_term->name.'</a></li>';
}
endwhile; endif;
wp_reset_query();

$the_query = new WP_Query( 'post_type=portfolio&portfolio_types='$taxonomy );
while ( $the_query->have_posts() ) :
 $the_query->the_post(); 
 the_title();
endwhile;

You will need to change the post_type and the taxonomy to yours (not tested though)

Basically what the script does is find all the taxonomy terms, and when it finds one it looks for any posts under that term.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.