让ecshop购物车中显示商品品牌

如何在ecshop的购物车页面加商品品牌呢,下面跟ecshop模板堂的技术,来手动添加一下吧

1.在includes/lib_order.php 中找到 cart_goods() 函数(约873行)里:
$arr[$key]['formated_subtotal'] = price_format($value['subtotal'], false);
在这段代码下面加上一段程序(如下所示): 
$sql="sel ect brand_name from ".$GLOBALS['ecs']->table('goods')." g left join " . $GLOBALS['ecs']->table("brand") . " b on  g.brand_id=b.brand_id where goods_id='{$value['goods_id']}'";
$goods_brand = $GLOBALS['db']->getOne($sql);
$arr[$key]['goods_brand']=$goods_brand; 
2.在get_cart_goods() 函数(约1603行)中找到$goods_list[] = $row; 
在这段代码的上方加上一段代码如下所示:
$sql="sel ect brand_name from ".$GLOBALS['ecs']->table('goods')." g left join " . $GLOBALS['ecs']->table("brand") . " b on  g.brand_id=b.brand_id where goods_id='{$row['goods_id']}'";
$goods_brand = $GLOBALS['db']->getOne($sql);
$row['goods_brand']=$goods_brand; 
3.接下来我们需要修改一下flow.dwt模板文件,找到
<!-- {if $goods.is_shipping} -->(<span style="color:#FF0000">{$lang.free_goods}</span>)<!-- {/if} --> 
在这段代码的后面加上:
{$goods.goods_brand},
4.然后我们还要找到 
<a href="goods.php?id={$goods.goods_id}" target="_blank"><img src="{$goods.goods_thumb}" border="0" title="{$goods.goods_name|escape:html}" /></a><br /> 
在它后面增加代码
品牌:{$goods.goods_brand}

(0)

相关推荐