ecshop实现对市场价折扣和评价数量显示的代码

1,744次阅读
没有评论

只需在所需要的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即可。

正文完
 

公众号