如何在ecshop商品列表页增加品牌及品牌链接显示的方法

1、打开category.php文件

$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
改为

$sql = 'SELECT g.goods_id,g.brand_id,b.brand_name,b.brand_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .
'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .


$arr[$row['goods_id']]['name'] = $row['goods_name'];
下增加一行
$arr[$row['goods_id']]['brand_name'] = $row['brand_name'];

$arr[$row['goods_id']]['brand_id'] = $row['brand_name'];

2、修改 themes/default/library/goods_list.lbi
在你想要显示品牌的地方加入 {$goods.brand_name}


你可能感兴趣的:(ecshop,商品列表,品牌链接)