关于让ecshop首页的销售排行显示指定价格区间的商品
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
很多ecshop网店的商品价格多样,往往便宜的小商品或者补拍邮费之类的销售量最大,但这些非主体商品显示在排行榜中很不好看,对广告宣传效果也不好。如果指定某个价格以上的商品才显示在排行榜中,则好看多了。修改方法如下:
1、打开\\includes\\lib_goods.php,把function get_top10($cats = '')函数另复制一个并稍修改一下(原代码不要改,不然分类页全都变了),改成如下样子:
很多网店的商品价格多样,往往便宜的小商品或者补拍邮费之类的销售量最大,但这些非主体商品显示在排行榜中很不好看,对广告宣传效果也不好。如果指定某个价格以上的商品才显示在排行榜中,则好看多了。修改方法如下:
1、打开\\includes\\lib_goods.php,把function get_top10($cats = '')函数另复制一个并稍修改一下(原代码不要改,不然分类页全都变了),改成如下样子:
* 首页调用销售排行榜
*
* @access public
* @param string $cats 查询的分类
* @return array
*/
function get_index_top10($cats = '')
{
$cats = get_children($cats);
$where = !empty($cats) ? "AND ($cats OR " . get_extension_goods($cats) . ") " : '';
$sql = 'SELECT g.goods_id, g.goods_name, g.shop_price, g.goods_thumb, SUM(og.goods_number) as goods_number ' .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g, ' .
$GLOBALS['ecs']->table('order_info') . ' AS o, ' .
$GLOBALS['ecs']->table('order_goods') . ' AS og ' .
"WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.shop_price >= 10 AND g.is_delete = 0 $where $top10_time " ;
//判断是否启用库存,库存数量是否大于0
if ($GLOBALS['_CFG']['use_storage'] == 1)
{
$sql .= " AND g.goods_number > 0 ";
}
$sql .= ' AND og.order_id = o.order_id AND og.goods_id = g.goods_id ' .
"AND (o.order_status = '" . OS_CONFIRMED . "' OR o.order_status = '" . OS_SPLITED . "') " .
"AND (o.pay_status = '" . PS_PAYED . "' OR o.pay_status = '" . PS_PAYING . "') " .
"AND (o.shipping_status = '" . SS_SHIPPED . "' OR o.shipping_status = '" . SS_RECEIVED . "') " .
'GROUP BY g.goods_id ORDER BY goods_number DESC, g.goods_id DESC LIMIT ' . $GLOBALS['_CFG']['top_number'];
$arr = $GLOBALS['db']->getAll($sql);
for ($i = 0, $count = count($arr); $i < $count; $i++)
{
$arr[$i]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
sub_str($arr[$i]['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $arr[$i]['goods_name'];
$arr[$i]['url'] = build_uri('goods', array('gid' => $arr[$i]['goods_id']), $arr[$i]['goods_name']);
$arr[$i]['thumb'] = get_image_path($arr[$i]['goods_id'], $arr[$i]['goods_thumb'],true);
$arr[$i]['price'] = price_format($arr[$i]['shop_price']);
$arr[$i]['buy_num'] = get_buy_sum($arr[$i]['goods_id']);
}
return $arr;
}
2、打开\\index.php,找到
$smarty->assign('top_goods', get_top10());
修改为
$smarty->assign('top_goods', get_index_top10());
后台清除缓存,首页排行榜显示的就是价格在10元以上的商品了。
最近更新
常用插件
- ecshop二次开发商品购买增
图片1香...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
ecshop热门问答
ecshop热门资料
ecshopanimate
ecshop已确认
ecshopcommon
ecshoppaydollar
ecshop定时
ecshop商店关键字
ecshopFLAHS
ecshop答复
ecshop需求
ecshopvancl
ecshop相关商品
ecshop退换
ecshop教学
ecshopleapftp
ecshoponline
ecshop商品详情图
ecshop衣裙
ecshoprestriction
ecshop数据库备份
ecshop儿童服装
ecshop负数
ecshopCESHOP
ecshopEnTemplate
ecshop批量处理
主机宝
ecshop解析
ecshop自动发布
ecshopPUBLIC
ecshop虚拟卡购买
ecshop底部帮助信息