ecshop购物车结算中心页面显示商品图片方法
2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家
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']); } } 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: 下面打开ecshop模板文件flow.dwt 搜索 在这个下面找到
最近更新
常用插件
- ecshop快递发货单打印商品
ecshop快递发货单打印商品信息,大家都知道ecshop快递单打印的时候,只能...
- ecshop按分类筛选销售排行
ecshop按分类筛选销售排行...
- ecshop供应商插件免费下载
ecshop供应商插件免费下载...
- ecshop选择下单时间插件
ecshop选择下单时间插件主要是根据不同的下单配送要求,在ecshop购物车...
- ecshop二次开发售后维修卡
插件介绍: 本插件是用于专门从事电子,信息,软件等售后服务关键比...