您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop购物车结算提交订单页面显示商品缩略图的方法
依珊2024-01-16 20:01:16ecshop商城教程已有人查阅
导读ECSHOP系统,在购物车页面,是可以显示商品缩略图的,但是ecshop在订单提交的页面却不支持显示缩略图,好在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”为所选择的模板目录。
查找:
<!-- {if $step eq "checkout"} 开始订单确认界面 --> <form action="flow.php" method="post" name="theForm" id="theForm" onsubmit="return checkOrderForm(this)"> <script type="text/javascript"> var flow_no_payment = "{$lang.flow_no_payment}"; var flow_no_shipping = "{$lang.flow_no_shipping}"; </script> <div class="flowBox"> <h6><span>{$lang.goods_list}</span><!--{if $allow_edit_cart} --><a href="flow.php" class="f6">{$lang.modify}</a><!--{/if} --></h6> <table width="99%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd"> <tr> <th bgcolor="#ffffff">{$lang.goods_name}</th> <th bgcolor="#ffffff">{$lang.goods_attr}</th> <!-- {if $show_marketprice} --> <th bgcolor="#ffffff">{$lang.market_prices}</th> <!-- {/if} --> <th bgcolor="#ffffff">{if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}</th> <th bgcolor="#ffffff">{$lang.number}</th> <th bgcolor="#ffffff">{$lang.subtotal}</th> </tr> <!-- {foreach from=$goods_list item=goods} --> <tr> <td bgcolor="#ffffff"> <!-- {if $goods.goods_id gt 0 && $goods.extension_code eq 'package_buy'} --> <a href="javascript:void(0)" onclick="setSuitShow({$goods.goods_id})" class="f6">{$goods.goods_name}<span style="color:#FF0000;">({$lang.remark_package})</span></a> <div id="suit_{$goods.goods_id}" style="display:none"> <!-- {foreach from=$goods.package_goods_list item=package_goods_list} --> <a href="goods.php?id={$package_goods_list.goods_id}" target="_blank" class="f6">{$package_goods_list.goods_name}</a><br /> <!-- {/foreach} --> </div> <!-- { else } --> <a href="goods.php?id={$goods.goods_id}" target="_blank" class="f6">{$goods.goods_name}</a> <!-- {if $goods.parent_id > 0} --> <span style="color:#FF0000">({$lang.accessories})</span> <!-- {elseif $goods.is_gift} --> <span style="color:#FF0000">({$lang.largess})</span> <!-- {/if} --> <!-- {/if} --> <!-- {if $goods.is_shipping} -->(<span style="color:#FF0000">{$lang.free_goods}</span>)<!-- {/if} --> </td> <td bgcolor="#ffffff">{$goods.goods_attr|nl2br}</td> <!-- {if $show_marketprice} --> <td align="right" bgcolor="#ffffff">{$goods.formated_market_price}</td> <!-- {/if} --> <td bgcolor="#ffffff" align="right">{$goods.formated_goods_price}</td> <td bgcolor="#ffffff" align="right">{$goods.goods_number}</td> <td bgcolor="#ffffff" align="right">{$goods.formated_subtotal}</td> </tr> <!-- {/foreach} --> <!-- {if !$gb_deposit} 团购且有保证金时不显示 --> <tr> <td bgcolor="#ffffff" colspan="7"> <!-- {if $discount gt 0} -->{$your_discount}<br /><!-- {/if} --> {$shopping_money}<!-- {if $show_marketprice} -->,{$market_price_desc}<!--{/if}--> </td> </tr> <!-- {/if} --> </table>
替换为:
<!-- {if $step eq "checkout"} 开始订单确认界面 --> <form action="flow.php" method="post" name="theForm" id="theForm" onsubmit="return checkOrderForm(this)"> <script type="text/javascript"> var flow_no_payment = "{$lang.flow_no_payment}"; var flow_no_shipping = "{$lang.flow_no_shipping}"; </script> <div class="flowBox"> <h6><span>{$lang.goods_list}</span><!--{if $allow_edit_cart} --><a href="flow.php" class="f6">{$lang.modify}</a><!--{/if} --></h6> <table width="99%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd"> <tr> <th bgcolor="#ffffff">商品图片</th> <th bgcolor="#ffffff">{$lang.goods_name}</th> <th bgcolor="#ffffff">{$lang.goods_attr}</th> <!-- {if $show_marketprice} --> <th bgcolor="#ffffff">{$lang.market_prices}</th> <!-- {/if} --> <th bgcolor="#ffffff">{if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}</th> <th bgcolor="#ffffff">{$lang.number}</th> <th bgcolor="#ffffff">{$lang.subtotal}</th> </tr> <!-- {foreach from=$goods_list item=goods} --> <tr> <td bgcolor="#ffffff" align="center"><img style="width:60px; border:1px solid #e3e3e3" src="{$goods.goods_thumb}" border="1" title="{$goods.goods_name|escape:html}"/></td> <td bgcolor="#ffffff"> <!-- {if $goods.goods_id gt 0 && $goods.extension_code eq 'package_buy'} --> <a href="javascript:void(0)" onclick="setSuitShow({$goods.goods_id})" class="f6">{$goods.goods_name}<span style="color:#FF0000;">({$lang.remark_package})</span></a> <div id="suit_{$goods.goods_id}" style="display:none"> <!-- {foreach from=$goods.package_goods_list item=package_goods_list} --> <a href="goods.php?id={$package_goods_list.goods_id}" target="_blank" class="f6">{$package_goods_list.goods_name}</a><br /> <!-- {/foreach} --> </div> <!-- { else } --> <a href="goods.php?id={$goods.goods_id}" target="_blank" class="f6">{$goods.goods_name}</a> <!-- {if $goods.parent_id > 0} --> <span style="color:#FF0000">({$lang.accessories})</span> <!-- {elseif $goods.is_gift} --> <span style="color:#FF0000">({$lang.largess})</span> <!-- {/if} --> <!-- {/if} --> <!-- {if $goods.is_shipping} -->(<span style="color:#FF0000">{$lang.free_goods}</span>)<!-- {/if} --> </td> <td bgcolor="#ffffff">{$goods.goods_attr|nl2br}</td> <!-- {if $show_marketprice} --> <td align="right" bgcolor="#ffffff">{$goods.formated_market_price}</td> <!-- {/if} --> <td bgcolor="#ffffff" align="right">{$goods.formated_goods_price}</td> <td bgcolor="#ffffff" align="right">{$goods.goods_number}</td> <td bgcolor="#ffffff" align="right">{$goods.formated_subtotal}</td> </tr> <!-- {/foreach} --> <!-- {if !$gb_deposit} 团购且有保证金时不显示 --> <tr> <td bgcolor="#ffffff" colspan="7"> <!-- {if $discount gt 0} -->{$your_discount}<br /><!-- {/if} --> {$shopping_money}<!-- {if $show_marketprice} -->,{$market_price_desc}<!--{/if}--> </td> </tr> <!-- {/if} --> </table>
第二步也可以不用这样替换,你可以自己使用以下商品图片调用代码,在自己想要显示的位置插入代码就行了:
<img src="{$goods.goods_thumb}" border="0" title="{$goods.goods_name|escape:html}" />
后台刷新缓存就可以了
步骤一、打开 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”为所选择的模板目录。
查找:
<!-- {if $step eq "checkout"} 开始订单确认界面 --> <form action="flow.php" method="post" name="theForm" id="theForm" onsubmit="return checkOrderForm(this)"> <script type="text/javascript"> var flow_no_payment = "{$lang.flow_no_payment}"; var flow_no_shipping = "{$lang.flow_no_shipping}"; </script> <div class="flowBox"> <h6><span>{$lang.goods_list}</span><!--{if $allow_edit_cart} --><a href="flow.php" class="f6">{$lang.modify}</a><!--{/if} --></h6> <table width="99%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd"> <tr> <th bgcolor="#ffffff">{$lang.goods_name}</th> <th bgcolor="#ffffff">{$lang.goods_attr}</th> <!-- {if $show_marketprice} --> <th bgcolor="#ffffff">{$lang.market_prices}</th> <!-- {/if} --> <th bgcolor="#ffffff">{if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}</th> <th bgcolor="#ffffff">{$lang.number}</th> <th bgcolor="#ffffff">{$lang.subtotal}</th> </tr> <!-- {foreach from=$goods_list item=goods} --> <tr> <td bgcolor="#ffffff"> <!-- {if $goods.goods_id gt 0 && $goods.extension_code eq 'package_buy'} --> <a href="javascript:void(0)" onclick="setSuitShow({$goods.goods_id})" class="f6">{$goods.goods_name}<span style="color:#FF0000;">({$lang.remark_package})</span></a> <div id="suit_{$goods.goods_id}" style="display:none"> <!-- {foreach from=$goods.package_goods_list item=package_goods_list} --> <a href="goods.php?id={$package_goods_list.goods_id}" target="_blank" class="f6">{$package_goods_list.goods_name}</a><br /> <!-- {/foreach} --> </div> <!-- { else } --> <a href="goods.php?id={$goods.goods_id}" target="_blank" class="f6">{$goods.goods_name}</a> <!-- {if $goods.parent_id > 0} --> <span style="color:#FF0000">({$lang.accessories})</span> <!-- {elseif $goods.is_gift} --> <span style="color:#FF0000">({$lang.largess})</span> <!-- {/if} --> <!-- {/if} --> <!-- {if $goods.is_shipping} -->(<span style="color:#FF0000">{$lang.free_goods}</span>)<!-- {/if} --> </td> <td bgcolor="#ffffff">{$goods.goods_attr|nl2br}</td> <!-- {if $show_marketprice} --> <td align="right" bgcolor="#ffffff">{$goods.formated_market_price}</td> <!-- {/if} --> <td bgcolor="#ffffff" align="right">{$goods.formated_goods_price}</td> <td bgcolor="#ffffff" align="right">{$goods.goods_number}</td> <td bgcolor="#ffffff" align="right">{$goods.formated_subtotal}</td> </tr> <!-- {/foreach} --> <!-- {if !$gb_deposit} 团购且有保证金时不显示 --> <tr> <td bgcolor="#ffffff" colspan="7"> <!-- {if $discount gt 0} -->{$your_discount}<br /><!-- {/if} --> {$shopping_money}<!-- {if $show_marketprice} -->,{$market_price_desc}<!--{/if}--> </td> </tr> <!-- {/if} --> </table>
替换为:
<!-- {if $step eq "checkout"} 开始订单确认界面 --> <form action="flow.php" method="post" name="theForm" id="theForm" onsubmit="return checkOrderForm(this)"> <script type="text/javascript"> var flow_no_payment = "{$lang.flow_no_payment}"; var flow_no_shipping = "{$lang.flow_no_shipping}"; </script> <div class="flowBox"> <h6><span>{$lang.goods_list}</span><!--{if $allow_edit_cart} --><a href="flow.php" class="f6">{$lang.modify}</a><!--{/if} --></h6> <table width="99%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd"> <tr> <th bgcolor="#ffffff">商品图片</th> <th bgcolor="#ffffff">{$lang.goods_name}</th> <th bgcolor="#ffffff">{$lang.goods_attr}</th> <!-- {if $show_marketprice} --> <th bgcolor="#ffffff">{$lang.market_prices}</th> <!-- {/if} --> <th bgcolor="#ffffff">{if $gb_deposit}{$lang.deposit}{else}{$lang.shop_prices}{/if}</th> <th bgcolor="#ffffff">{$lang.number}</th> <th bgcolor="#ffffff">{$lang.subtotal}</th> </tr> <!-- {foreach from=$goods_list item=goods} --> <tr> <td bgcolor="#ffffff" align="center"><img style="width:60px; border:1px solid #e3e3e3" src="{$goods.goods_thumb}" border="1" title="{$goods.goods_name|escape:html}"/></td> <td bgcolor="#ffffff"> <!-- {if $goods.goods_id gt 0 && $goods.extension_code eq 'package_buy'} --> <a href="javascript:void(0)" onclick="setSuitShow({$goods.goods_id})" class="f6">{$goods.goods_name}<span style="color:#FF0000;">({$lang.remark_package})</span></a> <div id="suit_{$goods.goods_id}" style="display:none"> <!-- {foreach from=$goods.package_goods_list item=package_goods_list} --> <a href="goods.php?id={$package_goods_list.goods_id}" target="_blank" class="f6">{$package_goods_list.goods_name}</a><br /> <!-- {/foreach} --> </div> <!-- { else } --> <a href="goods.php?id={$goods.goods_id}" target="_blank" class="f6">{$goods.goods_name}</a> <!-- {if $goods.parent_id > 0} --> <span style="color:#FF0000">({$lang.accessories})</span> <!-- {elseif $goods.is_gift} --> <span style="color:#FF0000">({$lang.largess})</span> <!-- {/if} --> <!-- {/if} --> <!-- {if $goods.is_shipping} -->(<span style="color:#FF0000">{$lang.free_goods}</span>)<!-- {/if} --> </td> <td bgcolor="#ffffff">{$goods.goods_attr|nl2br}</td> <!-- {if $show_marketprice} --> <td align="right" bgcolor="#ffffff">{$goods.formated_market_price}</td> <!-- {/if} --> <td bgcolor="#ffffff" align="right">{$goods.formated_goods_price}</td> <td bgcolor="#ffffff" align="right">{$goods.goods_number}</td> <td bgcolor="#ffffff" align="right">{$goods.formated_subtotal}</td> </tr> <!-- {/foreach} --> <!-- {if !$gb_deposit} 团购且有保证金时不显示 --> <tr> <td bgcolor="#ffffff" colspan="7"> <!-- {if $discount gt 0} -->{$your_discount}<br /><!-- {/if} --> {$shopping_money}<!-- {if $show_marketprice} -->,{$market_price_desc}<!--{/if}--> </td> </tr> <!-- {/if} --> </table>
第二步也可以不用这样替换,你可以自己使用以下商品图片调用代码,在自己想要显示的位置插入代码就行了:
<img src="{$goods.goods_thumb}" border="0" title="{$goods.goods_name|escape:html}" />
后台刷新缓存就可以了
本文标签:
很赞哦! ()
相关文章
随机图文
-
ecshop用户中心会员信息添加填写通关信息真实姓名字段并调用
ecshop用户中心会员信息添加填写证件信息,真实姓名字段并调用,用户中心里用户信息添加字段并调用,如真实姓名,证件号等 如图: 前台模板:user_t -
ecshop怎么修改后台登录地址
为了保证ECSHOP商城安全,需要修改许多默认的程序路径,今天讲下后台路径修改。 ECSHOP修改后台路径根据版本不同,修改的地方也不一样。我现在用的是2.7.3,上网查了资 -
ecshop后台admin路径的修改方法
ecshop如何修改后台admin路径?大家都知道ecshop的默认后台是admin,这样会导致网站不安全,容易被黑客入侵。因为一般的黑客入侵都是从后台 -
ecshop首页怎么滚动显示最新订单
ecshop添 加新功能我感觉无外乎就是两个地方的修改,显示的要修改模板,为了方便下次升级,很好都做成lbi,下次升级了直接把lbi拷进去
留言与评论 (共有 条评论) |