zencart随机获取一张产品图片及价格小程序

<?php
//header("content-Type: text/html; charset=utf-8"); 
//@set_time_limit(1800);
//@ini_set('memory_limit','100M');
require('includes/application_top.php');    
$listing_sql = "select products_id, products_image from " .TABLE_PRODUCTS. " order by rand() limit 1";   
$listing = $db->Execute($listing_sql);
echo '<center>';  
while (!$listing->EOF)
{   
    if(file_exists("images/" . $listing->fields['products_image'])) //判断图片是否存在   
    {   
        $products_id'];   
        if ($id!="")   
        {
            echo '<img src="images/'. $listing->fields['products_image'].'" /><br />';
            echo '<style>.normalprice{text-decoration:line-through;color:#999;}.productSpecialPrice{color:#f00;}</style>'.zen_get_products_display_price($id).'<br />';//输出价格
            /*if(zen_get_products_special_price($id)!=false){
                echo ''.zen_get_products_special_price($id).'';
            }else{
                echo ''.zen_get_products_base_price($id).'';
            }*/
            echo '<a href="http://'.$_SERVER['HTTP_HOST'].DIR_WS_CATALOG.'index.php?main_page=product_info&products_">http://'.$_SERVER['HTTP_HOST'].DIR_WS_CATALOG.'index.php?main_page=product_info&products_</a>';
        }   
    }   
    $listing->MoveNext();   
}
echo '</center>';  
?>

打完收工!