关于让ecshop商品列表显示获赠消费积分
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
1、打开category.php 找到 category_get_goods 函数 修改为
- function category_get_goods($children, $brand, $min, $max, $ext, $size, $page, $sort, $order)
- {
- $display = $GLOBALS['display'];
- $where = "g.is_on_sale = 1 AND g.is_alone_sale = 1 AND ".
- "g.is_delete = 0 AND ($children OR " . get_extension_goods($children) . ')';
- if ($brand > 0)
- {
- $where .= "AND g.brand_id=$brand ";
- }
- if ($min > 0)
- {
- $where .= " AND g.shop_price >= $min ";
- }
- if ($max > 0)
- {
- $where .= " AND g.shop_price <= $max ";
- }
- /* 获得商品列表 */
- $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, IF(g.give_integral > -1, g.give_integral, g.shop_price) as integral, ' .
- "NULL.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .
- 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
- '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]' " .
- "WHERE $where $ext ORDER BY $sort $order";
- $res = $GLOBALS['db']->sel ectLimit($sql, $size, ($page - 1) * $size);
- $arr = array();
- while ($row = $GLOBALS['db']->fetchRow($res))
- {
- $goods_id = $row['goods_id'];
- $sql2= "sel ect sum(goods_number) as count from ".$GLOBALS['ecs']->table('order_goods')."where goods_id ='".$goods_id."'";
- $buy_num = $GLOBALS['db']->getOne($sql2);
- if ($row['promote_price'] > 0)
- {
- $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
- }
- else
- {
- $promote_price = 0;
- }
- /* 处理商品水印图片 */
- $watermark_img = '';
- if ($promote_price != 0)
- {
- $watermark_img = "watermark_promote_small";
- }
- elseif ($row['is_new'] != 0)
- {
- $watermark_img = "watermark_new_small";
- }
- elseif ($row['is_best'] != 0)
- {
- $watermark_img = "watermark_best_small";
- }
- elseif ($row['is_hot'] != 0)
- {
- $watermark_img = 'watermark_hot_small';
- }
- if ($watermark_img != '')
- {
- $arr[$row['goods_id']]['watermark_img'] = $watermark_img;
- }
- $arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
- if($display == 'grid')
- {
- $arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
- }
- else
- {
- $arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
- }
- $arr[$row['goods_id']]['count'] = $buy_num;
- $arr[$row['goods_id']]['name'] = $row['goods_name'];
- /* 修正积分:转换为可使用多少积分(原来是可以使用多少钱的积分) */
- $arr[$row['goods_id']]['integral'] = round($row['integral'],0);
- $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
- $arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
- $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
- $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
- $arr[$row['goods_id']]['type'] = $row['goods_type'];
- $arr[$row['goods_id']]['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : '';
- $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
- $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
- $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
- }
- return $arr;
- }
2、模板部分直接加
- {$goods.integral}积分
最近更新
常用插件
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...
- ecshop二次开发商品购买增
图片1香...
ecshop热门问答
ecshop热门资料
ecshop树装菜单
ecshopline
ecshop上传的文件
ecshop商品页
ecshop无法访问
ecshop薪酬
ecshop
ecshop评论添加问题
ecshop动态
ecshop变小
ecshopstate
ecshop热门产品
ecshop成千上万
ecmall函数手册
ecshop订阅
ecshop傲游浏览器
ecshop编程语言
ecshop品牌价格分类
ecshop倒计时
ecshopmate
ecshop绿色盒子
ecshopconsignee
ecshop解决问题
ecshop淘宝账号
ecshop英文版系统
ecshop操作后台
ecshop外包网站二次开发
ecshop遮住了
ecshop马来西亚
ecshop蚕丝被的好处