wordpress wp ecommerce last product

wordpress 設計theme 時需要在首頁取得wp ecommerce 的最新產品資料,可以用以下方法,輸出圖片,和title,網上找沒什麼資料,只好自己在widget 改一下那來用

[php]
global $wpdb;
$args = wp_parse_args( (array)$args, array( ‘number’ => 5 ) );

$number = 3;
$image = true;

$width = 150;

$height = 150;

$latest_products = get_posts( array(
‘post_type’ => ‘wpsc-product’,
‘numberposts’ => $number,
‘orderby’ => ‘post_date’,
‘post_parent’ => 0,
‘post_status’ => ‘publish’,
‘order’ => ‘DESC’
) );
$output = ”;

if ( count( $latest_products ) > 0 ) {
$output .= ‘