ECSHOP 让你的商城显示“下架商品”列表

 

1。根目录下search.php文件
(1)大概257行

            case 'new':
                $intro   = ' AND g.is_new = 1';
                $intromode ='new';
                $ur_here = $_LANG['new_goods'];
                break;


之后增加代码

            case 'old':
                $intro   = ' AND g.is_on_sale =0';
                $intromode ='old';
                $ur_here = $_LANG['old_goods'];
                break;

 

(2)大概370行

$sql   = "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".

        "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".

        "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";

 

替换为

if($_REQUEST['intro']=="old"){

$sql   = "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".

        "WHERE g.is_delete = 0 AND  g.is_alone_sale = 1 $attr_in ".

        "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";

}else{

  $sql   = "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".

        "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".

        "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";

}

 

(3)大概390行

$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, ".

                "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".

                "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".

            "FROM " .$ecs->table('goods'). " AS g ".

            "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".

                    "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".

            "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".

                "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .

            "ORDER BY $sort $order";


替换为

if($_REQUEST['intro']=="old"){

    $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, ".

                "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".

                "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".

            "FROM " .$ecs->table('goods'). " AS g ".

            "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".

                    "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".

            "WHERE g.is_delete = 0  AND g.is_alone_sale = 1 $attr_in ".

                "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .

            "ORDER BY $sort $order";

   }else{

       $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, ".

                "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".

                "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".

            "FROM " .$ecs->table('goods'). " AS g ".

            "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".

                    "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".

            "WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".

                "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .

            "ORDER BY $sort $order";



   }

 

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

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

 

 

posted on 2013-03-20 15:03  ECshop商城二次开发博客  阅读(1428)  评论(0编辑  收藏  举报

导航