首页商品显示品牌名称的修改 For 2.7

2016-07-07 16:18 来源:www.chinab4c.com 作者:ecshop专家



打开includes文件夹下的lib_goods.php文件,找到:

function assign_cat_goods($cat_id, $num = 0, $from = 'web')

将原来的sql="...........省略........."

改为:

$sql = 'SELECT g.goods_id, g.goods_name, g.market_price,g.brand_id,g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
'g.promote_price, promote_start_date, promote_end_date, g.goods_brief,br.brand_name, g.goods_thumb, g.goods_img ' .
"FROM " . $GLOBALS['ecs']->table('goods') . ' AS g '.
"LEFT JOIN " . $GLOBALS['ecs']->table('brand') ." AS br ".
"ON g.brand_id = br.brand_id ".
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]'".
'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND '.
'g.is_delete = 0 AND (' . $children . 'OR ' . get_extension_goods($children) . ') ' .
'ORDER BY g.sort_order, g.goods_id DESC';


找到:

$goods[$idx]['brief']= $row['goods_brief'];

在下面增加:

$goods[$idx]['brand_id']= $row['brand_id'];
$goods[$idx]['brand_name']= $row['brand_name'];



然后再cat_goods.lbi模板文件中添加{$goods.brand_name}和{$goods.brand_id}标签调用就可以了

就像我的:
<p><a href="brand.php?id={$goods.brand_id}" title="{$goods.brand_name}">{$goods.brand_name}</a></p>

QQ截图未命名.jpg

回答:
看起来不错哦,贴下演示地址看下

不错
支持下

支持了!!!

很不错的修改小技巧

看起来很好,可惜没法演示!

不错的修改方法

试过了,还是显示不出来! 1# coozu