找人开发还花钱,在这里小编辑把最常开发项分享给大家
(1)ECSHOP获取商品的销量
/includes/lib_insert.php,在最下面增加一个函数(注意别加在 “?>”外面 增加:
function insert_sales($arr)
//调用ecshop所有销量总数
{
$db = $GLOBALS['db'];
$ecs = $GLOBALS['ecs'];
$goods_id = $arr['id'];
$sql = "select sum(goods_number) from " . $GLOBALS['ecs']->table('order_goods') . " AS g ,".$GLOBALS['ecs']->table('order_info') . " AS o WHERE o.order_id=g.order_id and g.goods_id = " . $goods_id . " and o.order_status=5 " ;
if (($GLOBALS['db']->getOne($sql)) == ""){
return "0";
}else{
return $GLOBALS['db']->getOne($sql);
}
}
调用:
详细页调用:
已销售:{insert name='sales' id=$id}
分类页调用:
已销售:{insert name='sales' id=$goods.goods_id}
(2)获取ECSHOP评论总数
打开includesb_insert.php 文件,在最下面增加一个函数(注意别加在 “?>”外面 )
// 调用ecshop评论信息条数
function insert_commentnum($arr)
{
$count=$GLOBALS['db']->getOne('SELECT COUNT(*) FROM '. $GLOBALS['ecs']->table('comment')."WHERE id_value='$arr[id]'". "AND comment_type='$arr[type]' AND status = 1 AND parent_id = 0");
return $count;
}
(3)后台删除商品的同时,删除商品描述图。
打开admin/goods.php 约1685行。
$sql = "SELECT goods_id, goods_name,
增加:goods_desc,
搜索:
if (!empty($goods['original_img']))
{
@unlink('../' . $goods['original_img']);
}
后增加:
if($goods['goods_desc']){
preg_match_all("/<img(.*?)src=/"(.*?)/"[^>]*//>/is",$goods['goods_desc'],$arr);
if($arr[2]){//BY UUECS_Com
foreach($arr[2] as $k => $v){
@unlink("../".$v);
}
}
}
新闻热点
疑难解答