<div class="content_topp"> 系统,在购物车页面,是可以显示商品缩略图的,但是在订单提交的页面却不支持显示缩略图,好在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”为所选择的模板目录。
查找:
<div class="line number7 index6 alt2" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; background-color: rgb(245, 245, 245); line-height: 14.296875px; font-size: 13px; white-space: normal; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; left: auto !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; min-height: inherit !important;">
{$lang.goods_list}
{$lang.goods_name}
{$lang.goods_attr}
{$lang.market_prices}
{if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}
{$lang.number}
{$lang.subtotal}
({$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}
替换为:
{$lang.goods_list}
商品图片
{$lang.goods_name}
{$lang.goods_attr}
{$lang.market_prices}
{if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}
{$lang.number}
{$lang.subtotal}

({$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}
第二步也可以不用这样替换,你可以自己使用以下商品图片调用代码,在自己想要显示的位置插入代码就行了:

后台刷新缓存就可以了
|