商品导出中排除掉已下架的商品,应该怎么做啊,谢谢
2016-07-07 15:17 来源:www.chinab4c.com 作者:ecshop专家
在这个函数中,我已添加了一个g.is_on_sale =的条件,但如不选择关键字,直接导出所有的,还是会把已下架的导出来,应该应该怎么实现啊,谢谢 function get_export_where_sql($filter) { $where = ''; if (!empty($filter['goods_ids'])) { $goods_ids = explode(',', $filter['goods_ids']); if (is_array($goods_ids) && !empty($goods_ids)) { $goods_ids = array_unique($goods_ids); $goods_ids = "'" . implode("','", $goods_ids) . "'"; } else { $goods_ids = "'0'"; } $where = " WHERE g.is_on_sale =1 and g.is_delete = 0 AND g.goods_id IN (" . $goods_ids . ") "; } else { $_filter = new StdClass(); $_filter->cat_id = $filter['cat_id']; $_filter->brand_id = $filter['brand_id']; $_filter->keyword = $filter['keyword']; $where = get_where_sql($_filter); } return $where; } 这个函数我已加了条件,但如不点搜索,也就是下面部分还是会导出所有的商品,请问怎么改啊,谢谢 |
回答:
问题已解决,请看红字 function get_export_where_sql($filter) { $where = ''; if (!empty($filter['goods_ids'])) { $goods_ids = explode(',', $filter['goods_ids']); if (is_array($goods_ids) && !empty($goods_ids)) { $goods_ids = array_unique($goods_ids); $goods_ids = "'" . implode("','", $goods_ids) . "'"; } else { $goods_ids = "'0'"; } $where = " WHERE g.is_on_sale =1 and g.is_delete = 0 AND g.goods_id IN (" . $goods_ids . ") ";//这里注意g.is_on_sale=1 } else { $_filter = new StdClass(); $_filter->cat_id = $filter['cat_id']; $_filter->brand_id = $filter['brand_id']; $_filter->keyword = $filter['keyword']; $where = get_where_sql($_filter); $where =$where.' and g.is_on_sale =1 and g.is_delete = 0';//添加这句 } return $where; } |
这个很好啊。 |
想知道下架商品的数据库字段是什么,如何设置?有木有能回答地 |
最近更新
常用插件
- ecshop按分类筛选销售排行
ecshop按分类筛选销售排行...
- ecshop快递发货单打印商品
ecshop快递发货单打印商品信息,大家都知道ecshop快递单打印的时候,只能...
- ecshop供应商插件免费下载
ecshop供应商插件免费下载...
- ecshop选择下单时间插件
ecshop选择下单时间插件主要是根据不同的下单配送要求,在ecshop购物车...
- ecshop二次开发售后维修卡
插件介绍: 本插件是用于专门从事电子,信息,软件等售后服务关键比...
ecshop热门问答
ecshop热门资料
ecshop求英文模板
ecshop大侠
ecshopteam
ecshop水果网
ecshop销售价
ecshop惠價
ecshopsale
ecshop收款插件
ecshopRemote
ecshop呼叫中心
ecshopXmlhttp
ecshop鞋帽
ecshop快车道
ecshop结算中心小数
ecshop安全措施
ecshop无法创建管理员账号
ecshopecsop
ecshopAccess
ecshop放回购物车
ecshopchildren
ecshop左边区域
ecshopclothing模板
ecshopIE兼容
ecshop自动收缩
ecshop通栏广告位
ecshop网民
ecshop短消息
ecshop网吧
ecshop后遗症
ecshop业内人士