前几日,接到一客户的ECShop二次开发项目,需要在商品搜索页显示商品的货号。

1、打开search.php文件(建议使用editplus或Dreamweaver)

找到

$sql = “SELECT g.goods_id, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, “.

修改为

$sql = “SELECT g.goods_id, g.goods_sn, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, “.

继续找到

$arr[$row[‘goods_id’]][‘type’] = $row[‘goods_type’];

在这行下面增加以下代码:

$arr[$row[‘goods_id’]][‘goods_sn’] = $row[‘goods_sn’];

2、打开模板文件search.dwt,
在您想要显示商品货号的地方加上下面这句:

产品货号:{$goods.goods_sn}

去后台清空一下缓存,看是不是已经能够显示商品编号了。