Forums

[resolved] [Plugin: Wp e-commerce] loop (3 posts)

  1. silafu
    Member
    Posted 1 year ago #

    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!

  2. silafu
    Member
    Posted 1 year ago #

    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; ?>
  3. caricari
    Member
    Posted 8 months ago #

    It worked very fine!!! thanks solved my issue!

Topic Closed

This topic has been closed to new replies.

About this Topic