您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop结算页购物车提交订单页面显示商品缩略图的方法
听白2024-01-16 21:02:36ecshop商城教程已有人查阅
导读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}" />
{$goods.goods_thumb}就是商品缩略图
本文标签:
很赞哦! ()
相关文章
随机图文
-
ecshop缓存文件在哪,怎么关闭?
ECSHOP的缓存存放在templates/caches/文章夹下,时间长了这个文件夹就会非常庞大,拖慢网站速度。还有很多情况我们不需要他的缓存。小编整理本文介绍禁用ECSHOP缓存的方法。 -
ecshop其他页面调用首页FLASH主广告的实例代码
我想在ECSHOP商品分类页模板里面调用首页的FLASH主广告,应该怎么做呢?然后再修改模板文件 /themes/default/category.dwt (这里以官方默认模板为例) -
ecshop商城网站顶部会员实现ajax免刷新登录登出
ecshop可以在网站头部或者是在首页实现无刷新的ajax登录登出效果,代码如下只需找到themes/我的模板名称/library/member_info -
ecshop首页商品或商品列表页显示商品描述
ECSHOP后台商品编辑的地方有一个录入“商品简单描述”的框框,但是录入的“商品简单描述”没有很好的在前台显示出来,而只是在商品详细页的 description 里,供搜索引擎读取。
留言与评论 (共有 条评论) |