ECshop2.72 如何在结算中心页面显示出商品图片
2016-07-07 15:13 来源:www.chinab4c.com 作者:ecshop专家
做购物流程页面时要求显示商品图,EC系统默认在购物车页面是可以显示商品图片的,但是点结算后到结算中心页面你会发现只有商品名称,没有商品图如果我们在EC的购物流程相关文件对它的系统函数跟踪一下就会发现checkout步骤时根本没有从数据库中调出缩略图,下面把方法与大家共享,希望能给大家一点帮助 步骤1: 打开订单函数库文件lib_order.php 位于includes目录下 搜索 /** * 取得购物车商品 * @paramint$type类型:默认普通商品 * @returnarray购物车商品数组 */ 大概在852行左右,函数原来是 function cart_goods($type = CART_GENERAL_GOODS) { $sql = "SELECT rec_id, user_id, goods_id, goods_name, goods_sn, goods_number, " . "market_price, goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, is_shipping, " . "goods_price * goods_number AS subtotal " . "FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_type = '$type'"; $arr = $GLOBALS['db']->getAll($sql); /* 格式化价格及礼包商品 */ foreach ($arr as $key => $value) { $arr[$key]['formated_market_price'] = price_format($value['market_price'], false); $arr[$key]['formated_goods_price']= price_format($value['goods_price'], false); $arr[$key]['formated_subtotal']= price_format($value['subtotal'], false); if ($value['extension_code'] == 'package_buy') { $arr[$key]['package_goods_list'] = get_package_goods($value['goods_id']); } } return $arr; } 将它替换为 function cart_goods($type = CART_GENERAL_GOODS) { $sql = "SELECT c.rec_id, c.user_id, c.goods_id, c.goods_name, g.goods_thumb,c.goods_sn, c.goods_number, " . "c.market_price, c.goods_price, c.goods_attr, c.is_real, c.extension_code, c.parent_id, c.is_gift, c.is_shipping, " . "c.goods_price * c.goods_number AS subtotal " . "FROM " . $GLOBALS['ecs']->table('cart') . ' AS c ' . ' LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id ' . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_type = '$type'"; $arr = $GLOBALS['db']->getAll($sql); /* 格式化价格及礼包商品 */ foreach ($arr as $key => $value) { $arr[$key]['formated_market_price'] = price_format($value['market_price'], false); $arr[$key]['formated_goods_price']= price_format($value['goods_price'], false); $arr[$key]['formated_subtotal']= price_format($value['subtotal'], false); $arr[$key]['goods_thumb']= get_image_path($value['goods_id'], $value['goods_thumb'], true); if ($value['extension_code'] == 'package_buy') { $arr[$key]['package_goods_list'] = get_package_goods($value['goods_id']); } } return $arr; } 修改的作用是把cart表和goods表相连,取出goods_thumb缩略图,然后用get_image_path函数调出缩略图的地址 步骤2: 下面打开flow.dwt 搜索 <!-- {if $step eq "checkout"} 开始订单确认界面 --> 在这个下面找到 <!-- {foreach from=$goods_list item=goods} --> <tr> <td bgcolor="#ffffff"> <!-- {if $goods.goods_id gt 0 && $goods.extension_code eq 'package_buy'} --> </td> </tr> 在它的下面加入 <img src="{$goods.goods_thumb}" border="0" title="{$goods.goods_name|escape:html}" /> 这个就是调出商品的缩略图了,OK,完工! PS:如果大家想改下缩略图的大小,可以用以下代码,width是宽度,height是高度,可以自己调 <img src="{$goods.goods_thumb}" border="0" title="{$goods.goods_name|escape:html}" width="50px" height="50px"/> |
回答:
通过goods id取得图片 |
最近更新
常用插件
- ecshop二次开发商品购买备
ecshop销售统计 插件介绍:ecshop二次开发订单销售统计和商品购买备注服...
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop2.7.2退换货申请插件
ecshop2.7.2退换货申请插件,主要是在 ecshop 现在的基础上,对ecshop的订单处...
- ecshop会员中心订单excel倒出
ecshop会员中心订单excel倒出...
- ecshop注册推荐送现金插件
ecshop中的促销售功能还不是很完善,随着电子商务系统的发展和进步,...
ecshop热门问答
ecshop热门资料
ecshop根本
ecshopauto
ecshop请教
ecshop图画
ecshop相册
ecshop说明性
ecshop订单表
ecshop创始人密码
ecmall挂件
ecshop失所
ecshopnew
ecshop成果
ecshopecmall支付功能
ecshop办理
ecshopSitemap
ecshop前位置:首页
ecshop求救
ecshop登录淘宝
ecshop属性设置
ecshop零数
ecshop销售平台
ecshopGCOGO
ecshop搜索栏
ecshopshow
ecshop农行
ecshop网络连接
ecshop网卡
ecshop回车
ecshop服务器租用
ecshop礼品赠送索取