您现在的位置是:首页 > 教程 > 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的时候,为了省事,用了默认的表前缀 ecs_ 使用一段时间后,突然想起要修改表前缀,那么这时候该如何修改呢,网站已经有很多数据了。 -
ecshop商城首页显示在线人数怎么添加
今天为大家详细解说一下ECSHOP商城首页显示在线人数添加方法,在ECSHOP中有在线人数的调用方法! -
ecshop商品页怎么显示品牌LOGO
问:ecshop商品详细页面的商品品牌默认是以文字形式显示的,能否改成以LOGO形式显示。答:当然可以,下面看教程。 -
ecshop模板安装,ecshop模板更换,ecshop模板上传方法
不少用户自行下载了模板不会安装,我们在这里提供了简单的安装方法供新手参考,一般来说,ECSHOP模板安装分为两种:
留言与评论 (共有 条评论) |