php - WP Ecommerce getting products in a category -


i'm developing site wp ecommerce , i'd show products within category on home page simple way "featured products".

the problem i'm having query returning products rather within single category. right i'm using code found somewhere through google:

$args = array( 'post_type' => 'wpsc-product', 'tax_query' => array(     'taxonomy' => 'category',        'field' => 'slug',     'terms' => 'homepage-featured' )); $wp_query = new wp_query( $args ); while( $wp_query->have_posts() ) : $wp_query->the_post(); (etc...) 

i've tried using standard get_posts function "'category' => 3" since wpec seems store product data in standard wordpress post format, returned nothing. if used "'category' => 'cat_slug'" or "'category' => 'full_cat_name'" returned products again.

anyone know how works?!

cheers, -- ben.

i've had implement similar category filter main shop, here original code modified;

$args = array(     'post_type' => 'wpsc-product',     'tax_query' => array(         array(             'taxonomy' => 'wpsc_product_category',                'field' => 'slug',             'terms' => 'homepage-featured'         )     ) ); $wp_query = new wp_query( $args ); 

note modified taxonomy wpsc_product_category specific wp ecommerce, , nested array within tax_query array, wp_query class allows multiple taxonomy queries.

for full list of possible parameters , features wp_query, have at; http://codex.wordpress.org/class_reference/wp_query


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -