ECshop 如何在购物结算中心页面显示出商品图片
2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家
做购物流程页面时要求显示商品图,EC系统默认在购物车页面是可以显示商品图片的,但是点结算后到结算中心页面你会发现只有商品名称,没有商品图如果我们在EC的购物流程相关文件对它的系统函数跟踪一下就会发现checkout步骤时根本没有从数据库中调出缩略图,下面把方法与大家共享,希望能给大家一点帮助 步骤1: 打开订单函数库文件lib_order.php 位于includes目录下 搜索 /** * 取得购物车商品 * @param int $type 类型:默认普通商品 * @return array 购物车商品数组 */ 大概在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']); } http://hnsanya89.com http://weinsjb89.com http://jiuzhyu45.com } 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"/> |
最近更新
常用插件
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop商品分类名称增加样
ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样...
- ecshop2.7.1打印发货单插件
ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs...
- ecshop二次开发详细页面生
插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人...
ecshop热门问答
ecshop热门资料
ecshop注册用户
ecshop间距
ecshopWINNT
ecshop738
ecshop提货
ecshop实验品
ecshopget_shop_help
ecshop不方便
ecshop雅间
ecshop最热
ecshop精仿
ecshop联结
ecshopadmin
ecshopEC网站首页顶部
ecshop回收站
ecshop404未找到
ecshop撤销
ecshop建义
ecshop爱宠一号店
ecshop底部导航
ecshop打不开来连接
ecshop数据表
dedecmsseo
ecshop文件管理
ecshop恢复数据库
ecshop衣裙
ecshop模板共享
ecshopstarting
ecshopUCHOME
ecshop收货人地址