在ECSHOP首页显示积分商城里的商品
来源:互联网 发布:易企秀是什么软件 编辑:程序博客网 时间:2024/04/28 13:36
以ECSHOP2.7.2官方默认模板为基础
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 ' .' 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);$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"> <h3><span><a href="/exchange.php" class="f6">积分商城</a></span></h3> <div class="centerPadd"> <div class="clearfix goodsBox" style="border:none;"> <!--{foreach name=goods_exchange_list from=$goods_exchange_list item=exchange_goods}--> <div class="goodsItem"> <a href="{$exchange_goods.url}" target="_blank"><img src="{$exchange_goods.goods_thumb}" alt="{$exchange_goods.goods_name}" class="goodsimg" /></a><br /> <p><a href="{$exchange_goods.url}" target="_blank"> <!-- {if $exchange_goods.goods_style_name} --> <font class="f3">{$exchange_goods.goods_style_name}</font><br /> <!-- {else} --> <font class="f3">{$exchange_goods.goods_name}</font><br /> <!-- {/if} --> </a> </p>{$lang.exchange_integral}<font class="price">{$exchange_goods.exchange_integral}</font> </div> <!--{/foreach}--> <div class="more"><a href="/exchange.php"><img src="images/more.gif" /></a></div> </div> </div> </div></div><div class="blank5"></div>
3)、到后台清除下缓存,然后刷新首页就能看到效果了
- 在ECSHOP首页显示积分商城里的商品
- 在 ECSHOP 首页的每个商品下显示商品货号
- 在ECSHOP首页的订单查询里显示送货地址
- ECSHOP首页显示商品销量
- 在ECSHOP首页每个商品下显示已销售量
- 在ECSHOP首页显示商品总数和本月更新数
- [OK]ECSHOP后台的商品列表里显示商品品牌
- ECSHOP首页商品显示购买过的次数
- Ecshop如何在首页调用指定栏目的商品
- ecshop首页显示折扣的方法,ecshop商品显示折扣的方法
- ecshop首页显示热门点击商品
- ecshop首页显示特价商品倒计时
- 在ECSHOP商品列表页显示每个商品的品牌
- Ecshop用户中心的收藏列表里显示商品缩略图
- Ecshop修改首页精品推荐、新品上市、热卖商品的显示数量
- ecshop模板首页或列表页显示商品简单描述
- zen-cart如何在首页显示商品的简介描述
- ECShop在首页调用某分类下的商品列…
- BCH编码,解码,纠错
- ext2和ext3的区别整理
- ibatis like查询
- 关于系统文件下/mnt/asec
- Trie树
- 在ECSHOP首页显示积分商城里的商品
- Instagram Engineering • What Powers Instagram: Hundreds of Instances, Dozens of Technologies
- 心血来潮 测试的问答系列(一)
- AMQP协议
- JavaScript 开发者十款超级有用的工具
- 黑马程序员—ADO.NET
- Instagram 架构分析笔记
- C 中 getline (类似fgets) 的实现方法
- 串口驱动(三)