ECSHOP系統(tǒng),在購物車頁面,是可以顯示商品縮略圖的,但是ecshop在訂單提交的頁面卻不支持顯示縮略圖,好在ECSHOP是開源的,通過以下方法可以實現(xiàn):(修改前備份文件,以免出錯無法挽回)
步驟一、打開 include/lib_order.php 文件,查找以下代碼:
/** * 取得購物車商品 * @param int $type 類型:默認普通商品 * @return array 購物車商品數(shù)組 */ 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 購物車商品數(shù)組 */ 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"為所選擇的模板目錄。
查找: