让你的商城显示“下架商品”列表,个人小心得。

2016-07-07 15:01 来源:www.chinab4c.com 作者:ecshop专家

有些论坛朋友提出网店显示“下架商品”列表的需求,个人研究下,修改search.php 和 common.php 文件即可:
1。根目录下search.php文件
(1)大概257行
case 'new':
$intro= ' AND g.is_new = 1';
$intromode ='new';
$ur_here = $_LANG['new_goods'];
break;
之后增加代码:

  1. case 'old':
  2. $intro= ' AND g.is_on_sale =0';
  3. $intromode ='old';
  4. $ur_here = $_LANG['old_goods'];
  5. break;
复制代码


(2)大概370行

  1. $sql= "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".
  2. "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
  3. "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";
复制代码


替换为

  1. if($_REQUEST['intro']=="old"){
  2. $sql= "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".
  3. "WHERE g.is_delete = 0 ANDg.is_alone_sale = 1 $attr_in ".
  4. "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";
  5. }else{
  6. $sql= "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".
  7. "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
  8. "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";
  9. }
复制代码


(3)大概390行

  1. $sql = "SELECT g.goods_id, g.goods_sn, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ".
  2. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  3. "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".
  4. "FROM " .$ecs->table('goods'). " AS g ".
  5. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
  6. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
  7. "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
  8. "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .
  9. "ORDER BY $sort $order";
复制代码


替换为

  1. if($_REQUEST['intro']=="old"){
  2. $sql = "SELECT g.goods_id, g.goods_sn, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ".
  3. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  4. "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".
  5. "FROM " .$ecs->table('goods'). " AS g ".
  6. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
  7. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
  8. "WHERE g.is_delete = 0AND g.is_alone_sale = 1 $attr_in ".
  9. "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .
  10. "ORDER BY $sort $order";
  11. }else{
  12. $sql = "SELECT g.goods_id, g.goods_sn, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ".
  13. "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
  14. "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".
  15. "FROM " .$ecs->table('goods'). " AS g ".
  16. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
  17. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
  18. "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
  19. "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .
  20. "ORDER BY $sort $order";

  21. }
复制代码



2。修改languages/zh_cn/common.php
在$_LANG['new_goods'] = '新品上市';下增加代码 $_LANG['old_goods'] = '最新下架商品';

3。需要此功能的文字上添加链接 search.php?intro=old例如 :<a href="search.php?intro=old">最新下架</a>

回答:
思路是对的 

给个演示出来

楼主所做的是在前台还是后台的“下架商品”列表呢?

显示不出来啊 www.baidie88.cn大哥给点正确答案好不?

非常好,按以上操作方法,我的网站更新成功了,谢谢楼主!
分享给大家参考:http://www.315go.net

感谢!!!

真没整明白

菜鸟问一句,哪句话 表示商品下架了啊