ECSHOP结算页购物车提交订单页面显示商品缩略图的方法

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

ECSHOP系统,在购物车页面,是可以显示商品缩略图的,但是ECSHOP在订单提交的页面却不支持显示缩略图,好在ECSHOP是开源的,通过以下方法可以实现:(修改前备份文件,以免出错无法挽回)第一步、打开 include/lib_order.php 文件,查找以下代码:/** * 取得购物车商品 * @param   int     $type   类型:默认普通商品 * @return  array   购物车商品数组 */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;}替换为以下代码(注意备份):/** * 取得购物车商品 * @param   int     $type   类型:默认普通商品 * @return  array   购物车商品数组 */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)    {     /* LONGHTML 增加是否在购物车里显示商品图 */        if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != 'package_buy')        {            $goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`=".$arr[$key]['goods_id']);            $arr[$key]['goods_thumb'] = get_image_path($arr[$key]['goods_id'], $goods_thumb, true);        } // END           $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;}第二步:修改 themes/XXX/flow.dwt 文件; “XXX”为所选择的模板目录。查找:                        var flow_no_payment = "{$lang.flow_no_payment}";        var flow_no_shipping = "{$lang.flow_no_shipping}";                        

{$lang.goods_list}{$lang.modify}
                                  {$lang.goods_name}              {$lang.goods_attr}                            {$lang.market_prices}                            {if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}              {$lang.number}              {$lang.subtotal}                                                                          {$goods.goods_name}({$lang.remark_package})                                    {$package_goods_list.goods_name}                        
                    {$goods.goods_name}                                ({$lang.accessories})                                ({$lang.largess})                                    ({$lang.free_goods})                            {$goods.goods_attr|nl2br}                            {$goods.formated_market_price}                            {$goods.formated_goods_price}              {$goods.goods_number}              {$goods.formated_subtotal}                                                                            {$your_discount}              {$shopping_money},{$market_price_desc}                                                替换为:                        var flow_no_payment = "{$lang.flow_no_payment}";        var flow_no_shipping = "{$lang.flow_no_shipping}";                        
{$lang.goods_list}{$lang.modify}
                                  商品图片              {$lang.goods_name}              {$lang.goods_attr}                            {$lang.market_prices}                            {if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}              {$lang.number}              {$lang.subtotal}                                                                                    {$goods.goods_name}({$lang.remark_package})                                    {$package_goods_list.goods_name}