Title: [Plugin: Wp e-commerce] loop
Last modified: August 20, 2016

---

# [Plugin: Wp e-commerce] loop

 *  Resolved [silafu](https://wordpress.org/support/users/silafu/)
 * (@silafu)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-e-commerce-loop/)
 * Hi,
 * I’m using the “wp e-commerce” plugin, version 3.8.3
 * I want to show the latest products from a category.
 * Found this code:
 *     ```
       <?php
             $wpsc_query = new WPSC_query("category_id=4");
             while (wpsc_have_products()) : wpsc_the_product();
             echo '<div class="cr_cont"> <a href="'.wpsc_the_product_permalink().'"><img src="'.wpsc_the_product_image('57','57').'" alt="" /></a>
             <span class="rc_in">
             <h4><a href="'.wpsc_the_product_permalink().'">'.wpsc_the_product_title().'</a></h4>
             </span> </div>';
             endwhile;
             ?>
       ```
   
 * Paste it in home.php. The category id is correct. The weird thing is that it 
   outputs regular posts, not products, and not from category “4”.
 * Any ideeas?
 * Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [silafu](https://wordpress.org/support/users/silafu/)
 * (@silafu)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-e-commerce-loop/#post-2091911)
 * Found the solution thanks to lilqhgal (The Scarlett Johansson of wp-ecommerce
   <3)
 *     ```
       <?php $my_query = new WP_Query( array( 'post_type' => 'wpsc-product', 'wpsc_product_category'=>'mycategory' ) );
       while( $my_query->have_posts() ) : $my_query->the_post();?>
   
       <a href="<?php echo get_permalink( $product->ID ); ?>" title="<?php echo get_the_title( $product->ID ); ?>"><h2><?php the_title();?></h2>
        <img src="<?php echo wpsc_the_product_thumbnail(get_option('product_image_width'),get_option('product_image_height'),'','single'); ?>" alt="<?php the_title();?>"/></a>
   
       <?php endwhile; ?>
       ```
   
 *  [caricari](https://wordpress.org/support/users/caricari/)
 * (@caricari)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wp-e-commerce-loop/#post-2092222)
 * It worked very fine!!! thanks solved my issue!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Wp e-commerce] loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * 2 replies
 * 2 participants
 * Last reply from: [caricari](https://wordpress.org/support/users/caricari/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wp-e-commerce-loop/#post-2092222)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
