I am trying to modify a Wordpress widget made by Instinct, part of the WP e-Commerce package (great plugin, btw). The widget will display the most recently listed products from the database (see example here on the left). Currently, it is set up to display all thumbs in one column. I am hoping to modify it to display two columns of images instead of just one, but can't seem to get the images into the table.
Here's where I'm at currently. I think the table is forming, but no cells are being populated. I would appreciate any help, thanks!
function nzshpcrt_latest_product($input = null) {
global $wpdb;
$siteurl = get_option('siteurl');
$latest_product = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `active` IN ('1') ORDER BY `id` DESC LIMIT 10", ARRAY_A);
if($latest_product != null) {
$output = "<div>";
echo "<table cellpadding='5' cellspacing='5' border='1'>";
$count = 0;
if(($count % 2) == 0){
echo("</tr><tr>\n");
$count++;
}
else{
$count++;
foreach($latest_product as $special) {
$output.="<div>";
$output .= " <div class='item_image'>";
$output.=" <a href='".wpsc_product_url($special['id'],$special['category'])."'>";
if(($special['image'] > 0)) {
if(get_option('wpsc_selected_theme') == 'marketplace') {
$src = WPSC_IMAGE_URL.$special['image'];
$output .= " <img src='". "index.php?image_id={$special['image']}&width=100&height=75' title='".$special['name']."' alt='".$special['name']."' />";
} else {
$output .= " <img src='". "index.php?image_id={$special['image']}&width=45&height=25' title='".$special['name']."' alt='".$special['name']."' /> ";
}
} else {
//$output .= "<img src='$siteurl/wp-content/plugins/wp-shopping-cart/no-image-uploaded.gif' title='".$special['name']."' alt='".$special['name']."' /><br />";
}
$output.=" </a>";
$output .= " </div>";
$output.=" <a href='".wpsc_product_url($special['id'],$special['category'])."'>";
$output .= " <strong>".stripslashes($special['name'])."</strong><br />";
$output .= " </a>";
$output .= "</div>";
}
}
$output .= "</div>";
} else {
$output = '';
}
echo("</table>");
echo $input.$output;
}
Kris