- 4
- 0
- 约3.07千字
- 约 3页
- 2017-06-09 发布于北京
- 举报
ECSHOP首页显示ecshop积分商城里的商品方法
ECSHOP教程网: HYPERLINK /ecshop-ercikaifa/272.htm /ecshop-ercikaifa/272.htm
下面就以ECSHOP官方默认模板为基础,给大家提供一个完整的解决方案。
(本教程由ECSHOP120()提供,如要转载,请注明出处)
1)、
首先打开 index.php 文件
在最末尾增加下面函数,注意千万不要写到 “?” 的外面去,要加在“?”的前面。
/**
* 获得积分商城热门商品
*
* @param int $limit 列出条数
* @param int $ishot 是否只显示热销
* @return array
*/
function index_get_exchange($limit=3,$ishot=0)
{
/* 获得热门积分商品列表 */
$sql_ishot=$ishot ? AND eg.is_hot=1 : ;
$sql = SELECT g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral, .
g.goods_type,g.goods_brief, g.goods_thumb, g.goods_img, eg.is_hot .
ECSHOP二次开发
FROM . $GLOBALS[ecs]-table(exchange_goods) . AS eg LEFT JOIN . $GLOBALS[ecs]-table(goods) . AS g ON g.goods_id = eg.goods_id .
WHERE eg.is_exchange = 1 AND g.is_delete = 0 . $sql_ishot . limit .$limit;
$res = $GLOBALS[db]-getAll($sql);
$arr = array();
foreach($res AS $idx = $row)
{
$arr[$idx][name] = $row[goods_name];
$arr[$idx][goods_brief] = $row[goods_brief];
$arr[$idx][goods_style_name] = add_style($row[goods_name],$row[goods_name_style]);
$arr[$idx][exchange_integral] = $row[exchange_integral];
$arr[$idx][type] = $row[goods_type];
$arr[$idx][goods_thumb] = get_image_path($row[goods_id], $row[goods_thumb], true);
转载请注明:文章转载自ECSHOP教程网
$arr[$idx][goods_img] = get_image_path($row[goods_id], $row[goods_img]);
$arr[$idx][url] = build_uri(exchange_goods, array(gid=$row[goods_id]), $row[goods_name]);
}
return $arr;
}
然后继续?? index.php 文件中 找到
$smarty-assign(shop_notice, $_CFG[shop_notice]); // 商店公告
在它下边另起一行增加如下代码
$smarty-assign(goods_exchange_list,index_get_exchange(6,0)); //积分商城
如果你想只显示热销的积分商品,只需将上面代码稍作修改即可
$smarty-assign(goods_exchange_list,index_get_exchange(6,1)); //积分商城
2)、下面继续修改模板文件 themes/default/index.dwt
在你想显示积分商城商品的地方,加入下面代码段
!--积分商城列表--
div class=box
div class=box_1
h3spana href=/exchange.php class=f6积分商城/a/span/h3
div class=centerPad
您可能关注的文档
- B型喷油泵凸轮轴断裂故障原因.docx
- b型流感嗜血杆菌结合疫苗使用说明.doc
- c03中层管理人员角色定位和沟通技巧.doc
- c0nfig配置文件讲解.doc
- Befksbz揭秘和人相处的24条黄金经典法则技巧归纳.doc
- C206汽车内饰材料可燃性.doc
- c0ut标准输出流常用控制格式.docx
- C.1医学装备的应急管理程序和规范流程图.doc
- C5_2_1管道隐蔽工程检查验收记录_2.doc
- C2B第3方策划方案.docx
- 2025广东广州市天河区拟招聘英语实习老师1人备考题库附答案.docx
- 2025广东广州市天河区城市管理第二保洁所招聘编外工作人员4人笔试备考试卷附答案解析.docx
- 2025广东广州市越秀区流花街道办事处招聘综合事务中心辅助人员1人笔试历年题库附答案解析.docx
- 2025广东广州市花都区新雅街清初级中学招聘临聘教师1人备考历年题库带答案解析.docx
- 2025广东广州市天河区城市管理第二保洁所招聘编外工作人员4人笔试备考试卷带答案解析.docx
- 江苏省盐城市东台市三仓镇区中学2026届八年级数学第一学期期末教学质量检测试题含解析.doc
- 2025广东广州市天河区城市管理第二保洁所招聘编外工作人员4人备考题库带答案解析.docx
- 江苏省盐城市亭湖区2026届数学八上期末考试试题含解析.doc
- 安徽省蚌埠市淮上区2026届数学八年级第一学期期末达标检测模拟试题含解析.doc
- 2025广东广湛城旅游轮有限公司招聘备考历年题库附答案解析.docx
原创力文档

文档评论(0)