您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop销售记录增加销售数量的方法
含烟2023-11-14 20:34:33ecshop商城教程已有人查阅
导读一、新建,goods_buy.lbi 文件加入如下代码;2、查找 $smarty->assign('goods', $goods);查找在最后一个标记之后
一、新建,goods_buy.lbi 文件加入如下代码
1、在文件尾加入两个函数
在其下一行加入
查找
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- {if $goods_buy} -->
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<tr>
<td colspan="4" align="right" bgcolor="#ffffff">{$goods_buy_num}</td>
</tr>
<tr>
<th bgcolor="#ffffff">会员ID</th>
<th bgcolor="#ffffff">客户地址</th>
<th bgcolor="#ffffff">订购数量</th>
<th bgcolor="#ffffff">订购时间</th>
</tr>
<!-- {foreach from=$goods_buy item=goodsbuy} 购买记录 -->
<tr>
<td bgcolor="#ffffff">{$goodsbuy.consignee}</td>
<td bgcolor="#ffffff">{$goodsbuy.address}</td>
<td bgcolor="#ffffff">{$goodsbuy.goods_number}</td>
<td bgcolor="#ffffff">{$goodsbuy.add_time}</td>
</tr>
<!-- {/foreach} -->
</table>
<!-- {/if} -->
二、修改goods.PHP文件,两处1、在文件尾加入两个函数
function get_goods_buy_list($goods_id)
{
$sql = "SELECT g.goods_id,o.consignee,o.add_time,g.goods_number,g.order_id,o.address".
" FROM " . $GLOBALS['ecs']->table('order_goods') . " AS g".
" LEFT JOIN " . $GLOBALS['ecs']->table('order_info') . " AS o on o.order_id=g.order_id".
" WHERE g.goods_id = " . $goods_id . " and o.order_status=1" .
" ORDER BY o.add_time LIMIT 10 ";
$res = $GLOBALS['db']->query($sql);
$arr = array();
while ($row = $GLOBALS['db']->fetchRow($res))
{
$row['add_time'] = local_date('Y-m-d H:i:s',$row['add_time']);
$row['address'] = sub_str($row['address'],6);
$arr[] = $row;
}
return $arr;
}
function get_goods_buy_num($goods_id)
{
$sql = "SELECT count(g.rec_id) as num".
" FROM " . $GLOBALS['ecs']->table('order_goods') . " AS g".
" LEFT JOIN " . $GLOBALS['ecs']->table('order_info') . " AS o on o.order_id=g.order_id".
" WHERE g.goods_id = " . $goods_id . " and o.shipping_status=1";
return $GLOBALS['db']->getOne($sql);
}
function get_goods_buy_sum($goods_id)
{
$sql = "SELECT sum(g.goods_number) as num".
" FROM " . $GLOBALS['ecs']->table('order_goods') . " AS g".
" WHERE g.goods_id = " . $goods_id . " " ;
return $GLOBALS['db']->getOne($sql);
}
2、查找 $smarty->assign('goods', $goods);在其下一行加入
//获取商品销售记录
$smarty->assign('goods_buy', get_goods_buy_list($goods_id));
$buy_num = get_goods_buy_num($goods_id);
if ($buy_num!= 0 )
sprintf("[%s]位顾客购买过", $buy_num);
$smarty->assign('goods_buy_num', $buy_num);
三、修改模板查找
<h2 class="h2bg"><span class="L"></span><span class="R"></span>{$lang.shopman_comment}</h2>
在其下加入
<h2 class="h2bg"><span class="L"></span><span class="R"></span>{$lang.goods_buy}</h2>
查找</blockquote>在最后一个标记之后
<!-- {/foreach} -->
</blockquote>
<!-- {/if} -->
在其下加入
<blockquote>
<!-- #BeginLibraryItem "/library/goods_buy.lbi" --><!-- #EndLibraryItem -->
</blockquote>
本文标签:
很赞哦! ()
随机图文
-
ecshop一键删除版权的方法
ECSHOP代码号为了大众新手准备一键ecshop去版权插件方便新手版权修改。1、前台 title的 Powered by ecshop -
ecshop首页调用指定商品分类下推荐热销很新商品
其实这个在ecshop中预留这个函数,不知道是不是开发者特意留下,但不想让所有人知道而已,函数在includes/lib_goods.php里面。 -
ecshop商品批量购买添加到购物车实现方法教学
ecshop中批量添加商品到购物车。大家都知道,默认的ecshop只能单件点击“添加到购物车”(Add to Cart)实现一件一件的添加商品到购物车,无法经过多选之后批量添加。 -
ecshop商品页调用热销商品的教程
在goods.php里面加了$smarty->assign('hot_goods',get_recommend_goods('hot
留言与评论 (共有 条评论) |