• Resolved silafu

    (@silafu)


    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

    (@silafu)

    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; ?>

    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.