首页和分类页调用商品货号的解决办法
2016-07-07 15:19 来源:www.chinab4c.com 作者:ecshop专家
找到网站根目录下面的includes目录,打开之后找到lib_goods.php文件,打开之后找到 /** * 获得推荐商品 * * @access public * @param string $type 推荐类型,可以是 best, new, hot, promote * @return array */ function get_recommend_goods($type = '', $cats = '') { if (!in_array($type, array('best', 'new', 'hot', 'promote'))) { return array(); } $time = gmtime(); $order_type = 0; /* 取得每一项的数量限制 */ $type2lib = array('best'=>'recommend_best', 'new'=>'recommend_new', 'hot'=>'recommend_hot', 'promote'=>'recommend_promotion'); $num = get_library_number($type2lib[$type]); $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, " . "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " . '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 '; 1。上面这段代码,在在goods_id 后添加 goods_sn,改后如下 $sql = 'SELECT g.goods_id, g.goods_sn, 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, " . "g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " . '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 '; 2.在后面不远处 添加代码$goods[$idx]['goods_sn']= $row['goods_sn'];,改后如下 $goods[$idx]['id']= $row['goods_id']; $goods[$idx]['name']= $row['goods_name']; $goods[$idx]['brief']= $row['goods_brief']; $goods[$idx]['goods_sn']= $row['goods_sn']; $goods[$idx]['brand_name']= $row['brand_name']; $goods[$idx]['goods_style_name']= add_style($row['goods_name'],$row['goods_name_style']); 3.接下来在你使用的风格的library中,修改recommend_best.lbi,增加{$goods.goods_sn}在需要显示位置就可以了。recommend_new.lbi,recommend_hot.lbi都是一样。 4.分类页的解决办法。其实跟上面的一样,大家先到根目录下找到category.php,打开找到 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, ' . "IFNULL(mp.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"; 在g.goods_id字段后面增加g.goods_sn,同时在下面不远处跟上面的相似,增加$arr[$row['goods_id']]['goods_sn']= $row['goods_sn'];程序部分修改了,接下来大家自己去修改相应风格的模板,增加{$goods.goods_sn}在需要显示位置就可以了。 搜索页是一样的道理,只要修改search.dwt和search.php即可 |
回答:
支持共享 |
支持共享并且感谢! |
不错,支持下。可以实现首页的商品货号 |
最近更新
常用插件
- ecshop选择下单时间插件
ecshop选择下单时间插件主要是根据不同的下单配送要求,在ecshop购物车...
- ecshop按分类筛选销售排行
ecshop按分类筛选销售排行...
- ecshop快递发货单打印商品
ecshop快递发货单打印商品信息,大家都知道ecshop快递单打印的时候,只能...
- ecshop二次开发售后维修卡
插件介绍: 本插件是用于专门从事电子,信息,软件等售后服务关键比...
- ecshop供应商插件免费下载
ecshop供应商插件免费下载...
ecshop热门问答
ecshop热门资料
ecshop地方的
ecshop概况
ecshop俺是新手
ecshop释放
ecshop变色
ecshop真实
ecshoporder_status
ecshoplighttpd
ecshop如何加入广告位
ecshop欢迎页
ecshop巴巴商城
ecshop加入收藏
ecshopsitmaps
ecshop热门搜索
ecshop前台
ecshop5800
ecshop英文域名
ecshop其他人
ecshop求人
ecshop现实
ecshop地方
ecshop问题求解
ecshopBigSale模板
ecshop减肥
ecshop慧聪网
ecshop虚拟点卡
ecshop工资
ecshop空间
ecshopLength
ecshop淘宝账号