Ecshop调取各个分类商品函数

//bangbang获取分类下商品
function get_cat_goods($cat_id,$limit){
	$sql = "select * from oyj_goods where cat_id=$cat_id order by goods_id  desc limit $limit";
    $arr = $GLOBALS['db']->getAll($sql);
	foreach($arr as $idx => $row){
	$goods[$idx]['market_price']        = price_format($row['market_price']);
    $goods[$idx]['shop_price']          = price_format($row['shop_price']);
	$goods[$idx]['goods_id']            = $row['goods_id'];
	$goods[$idx]['goods_thumb']         = $row['goods_thumb'];
	$goods[$idx]['goods_name']          = $row['goods_name'];
	}
	return $goods;
}


$smarty->assign('mbdb', get_cat_goods(6,4)); //美白淡斑

你可能感兴趣的:(sql)