阅读背景:

三级联动产品分类查询

来源:互联网 


ProductAction

public function index(){
    $tid = I("get.tid");
    if($tid==""){
        $tid=1;//$tid = M("Proclass")->where(array('pid'=>1,'lang'=>0))->order("orderby asc")->getField("id");
    }
    $id = I("get.id");
    if($id!=''){
        $tid=$id;
    }
    
    //产品列表
    $pro_data = $this->getPro($tid,$this->lang,0,1,1,9);
}

$this->assign("pro_data",$pro_data);

$this->display();

}

public function checkfirstid(){
    $first_id = I('first_id');
    $count = M('Proclass')->where(array('pid'=>$first_id))->count();
    $res=array();
    if($count>0){
        $res['status']=1;
        $res['proj'] = M('Proclass')->where(array('pid'=>$first_id))->field('id,proclassname')->select();

    }else{
        $res['status']=0;
        $res['proj']=M('Product')->where(array('cid'=>$firstId))->order('orderby asc')->select();

    }

    $this -> ajaxReturn($res);

}

public function firstclass(){
    $firstId=I('first_id');
    $proj=M('Product')
        ->where(array('cid'=>$firstId))
        ->order('orderby asc')
        ->select();
        foreach($proj as $k=>$v){
            echo '<div class="pro wow animated fadeIn" data-wow-duration="2s" data-wow-delay="0.3s">';
            echo '<div class="pro-img col-md-4"><img src="https://localhost/tailun/web/Public/Uploads/Product/'.$v[prophoto].'"/></div>';
            echo '<div class="pro-info col-md-5">';
            echo '<h5>'.$v[proname].'</h5>';
            echo '<p>'.$v[procontent].'</p>';
            echo '</div>';
            echo '<div class="col-md-3 read"><a href="/go.html?url=https://localhost/tailun/web/Product/proinfo/id/'.$v[id].'.html" class="more">点击浏览详细参数</a></div>';
            echo '<div class="clear"></div>';
            echo '</div>';
        }   


}

public function  secondclass(){
    $secondId=I('second_id');
    $proj=M('Product')
        ->where(array('cid'=>$secondId))
        ->order('orderby asc')
        ->select();
        foreach($proj as $k=>$v){
            echo '<div class="pro wow animated fadeIn" data-wow-duration="2s" data-wow-delay="0.3s">';
            echo '<div class="pro-img col-md-4"><img src="https://localhost/tailun/web/Public/Uploads/Product/'.$v[prophoto].'"/></div>';
            echo '<div class="pro-info col-md-5">';
            echo '<h5>'.$v[proname].'</h5>';
            echo '<p>'.$v[procontent].'</p>';
            echo '</div>';
            echo '<div class="col-md-3 read"><a href="/go.html?url=https://localhost/tailun/web/Product/proinfo/id/'.$v[id].'.html" class="more">点击浏览详细参数</a></div>';
            echo '<div class="clear"></div>';
            echo '</div>';
        }            

}

public function index(){
   



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: