如图所示: ecshop本身只有在购物车中涉及到折扣,我们要的不是那种,是单一商品的价比。 如下操作: 在include目录中,找到lib_goods.php,在最后增加如下函数: function get_zhekou($goods_id){$sql = select shop_price,market_price from . $GLOBALS['e 如图所示:ecshop本身只有在购物车中涉及到折扣,我们要的不是那种,是单一商品的价格比。如下操作:在include目录中,找到lib_goods.php,在最后增加如下函数:function get_zhekou($goods_id){$sql = "select shop_price,market_price from " . $GLOBALS['ecs']->table('goods') . " WHERE goods_id = " . $goods_id . " " ;$res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { $a = $row['shop_price'];//商品售价 $b = $row['market_price'];//商品市场价}$c = 10;if($b0){$c = $a/$b;}else {}//return number_format($c,2)*10;return number_format($c,2)*10;}登录后复制在该文件的327行附近,找到如下内容:$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);登录后复制在该行下方增加:$goods[$idx]['goods_zhekou']= get_zhekou($row['goods_id']); 登录后复制之后,在前台模板中增加调用的地方即可:比如: {if $goods.goods_zhekou} {$goods.goods_zhekou} {else} 0 {/if}折登录后复制完成,简单吧。
08-28 08:23