只需在所需要的foreach goods的代码中插入如下代码
$sql='select count(*) from '.$GLOBALS['ecs']->table('comment')." where comment_type=0 and id_value=".$row['goods_id'];
$comment_count=$GLOBALS['db']->getOne($sql);
//my
$goods[$idx]['zhekou'] = round($row['shop_price']/$row['market_price'],2)*10;
$goods[$idx]['comment_count']=$comment_count;
然后在模板中调用$goods.zhekou,$goods.comment_count即可。
正文完