修改ECSHOP后台的商品列表里显示该商品品牌

如何在在ECSHOP后台的商品列表中也显示商品的品牌”。
下面就来最模板讲一下如何来修改。此方法只保证在ECSHOP2.7.2版本下有效,其他版本请参照修改。

第一步:
首先我们来打开程序文件: /admin/includes/lib_goods.php

定位到 goods_list  函数部分

找到下面代码(大概在911行左右)

$sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, " .
                    " (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today') AS is_promote ".
                    " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='$is_delete' $where" .
                    " ORDER BY $filter[sort_by] $filter[sort_order] ".
                    " LIMIT " . $filter['start'] . ",$filter[page_size]";


将它修改为



$sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, " .
                    " (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today')  ".

“As is_promote,b.brand_name FROM”.$GLOBAs['ecs']->table('goods')."AS g".

"left join".$GLOBAs['ecs']->table('goods')."AS b on g.brand_id=b.brand_id".

"where is_delete='$is_delete'$where".
                    " ORDER BY $filter[sort_by] $filter[sort_order] ".
                    " LIMIT " . $filter['start'] . ",$filter[page_size]";


第二步:

修改 admin/templates/goods_list.htm 文件

找到

{$goods.goods_name|escape:html}

在它后面增加一行代码:

(品牌:{$goods.brand_name})

修改到这里,你会发现品牌是能显示出来了,但是搜索功能里的按品牌搜索却失效了。别着急,第三步就是来解决这个问题的。

第三步(很重要):

向上,找到下面代码(大概在865行左右)

$where .= " AND brand_id='$filter[brand_id]'";

将它修改为

$where .= " AND g.brand_id='$filter[brand_id]'";

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值