在Ecshop購物車或結算頁面顯示商品的品牌php
1.先打開 includes/lib_order.php html
找到 (大概是在873行)sql
$arr[$key]['formated_subtotal'] = price_format($value['subtotal'], false);
在它的下面增長如下代碼 函數
$sql="select 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.下面這一步千萬要認真,不能馬虎,仍是在includes/lib_order.php post
先找到 get_cart_goods() 函數部分,而後再找到此函數中的一行代碼spa
$goods_list[] = $row;
(注:此行代碼在includes/lib_order.php中出現了兩次,千萬別找錯了)code
找到這行代碼後,在它上面增長如下代碼orm
$sql="select 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 文件htm
找到ip
<!-- {if $goods.is_shipping} -->(<span style="color:#FF0000">{$lang.free_goods}</span>)<!-- {/if} -->
在他後面增長代碼
{$goods.goods_brand}
找到
<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}