ecshop首頁呼叫商品詳情或者其他商品內容

2022-04-12 05:22:40 字數 1931 閱讀 9872

1.查詢資料庫確定商品詳情欄位goods_desc

2.找到lib_goods.php

在第290行sql查詢新增查詢欄位g.goods_desc

**如下

//取出所有符合條件的商品資料,並將結果存入對應的推薦型別陣列中

$sql = 'select g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price as org_price, g.promote_price, ' .

"ifnull(mp.user_price, g.shop_price * '$_session[discount]') as shop_price, ".

"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_desc, g.goods_img, rand() as rnd " .

'from ' . $globals['ecs']->table('goods') . ' as g ' .

"left join " . $globals['ecs']->table('member_price') . " as mp ".

"on mp.goods_id = g.goods_id and mp.user_rank = '$_session[user_rank]' ";

在第316行找到

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

新增如下**

$goods[$idx]['desc']        = $row['goods_desc'];

3.在需要呼叫的首頁hot、new或者best等制定位置呼叫顯示**

truncate:200是指顯示字數

4.如果是在首頁制定分類下顯示商品詳情

修改的lib_goods.php**位置是第404行function get_category_recommend_goods()處

$sql =  'select g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price as org_price, g.promote_price, ' .

"ifnull(mp.user_price, g.shop_price * '$_session[discount]') as shop_price, ".

'promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name ' .

'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 ".

"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 ' . $brand_where . $price_where . $ext;

在477行出新增

$goods[$idx]['desc']        = $row['goods_desc'];

首頁對應位置呼叫即可

ecshop模板首頁或列表頁顯示商品簡單描述

1 在ecshop首頁顯示商品簡單描述 依次開啟 themes default library recommend hot.lbi themes default library recommend new.lbi themes default library recommend best.lbi 檔...

ecshop模板首頁或列表頁顯示商品簡單描述

1 在ecshop首頁顯示商品簡單描述 依次開啟 themes default library recommend hot.lbi themes default library recommend new.lbi themes default library recommend best.lbi 檔...

ecshop商品列表呼叫顯示商品屬性的方法

ecshop商品列表呼叫顯示商品屬性已經是乙個非常古老的話題,也是乙個非常值得去研究的話題。很多時候在ecshop二次開發的時候,很多朋友為了增加ecshop商品列表的可讀性。都提出要求在ecshop商品列表顯示ecshop屬性。先說說ecshop詳細頁面,ecshop商品詳細頁面,他呼叫屬性是通過...