>  기사  >  백엔드 개발  >  thinkphp 我的订单 1个订单号对应多个商品

thinkphp 我的订单 1个订单号对应多个商品

WBOY
WBOY원래의
2016-06-23 13:27:573603검색

要实现的效果图:





Thinkphp 代码:
public function myorder(){
     $obj = M();
      $sql = "select GROUP_CONCAT(oc.courseList_id ORDER BY oc.courseList_id DESC) AS courseList,o.order_id,o.user_id,o.user_name,o.number,o.orderTime,o.status,o.amount,oc.courseList_id from tb_order as o inner join tb_order_courselist as oc on o.order_id=oc.order_id where o.user_id=".$_SESSION['user_id']." group by o.order_id order by o.order_id desc";
      $orderData = $obj->query($sql);
      foreach ($orderData as $value){
       $sql_list = "select * from tb_order_courseList where courseList_id in(".$value['courseList'].")";
       $course_list = $obj->query($sql_list);
      
      }
    
     $this->assign("courseList",$course_list);
     $this->assign("orderData",$orderData);
     $this->display();
    }

模板代码:


                        

 我的订单


                        
                       
  课程信息
                               视频时长
                               单价
                               订单金额
                               订单状态 thinkphp 我的订单 1个订单号对应多个商品 
                              
                               操作 
                       

                       
                        

                            

                                          订单编号:
                            
 
                           
                            
                              
                              

                                 
                               
                                
                                
                                
                                
                                
                              
                             
                            

                               
                                        

                                            thinkphp 我的订单 1个订单号对应多个商品" alt="图片描述" />
                                            

                                                
授课老师:

                                                
">
                                                

                                                
有效期:

                                                

                                                

                                            

                                        

                                        
                                
分钟 未付款已付款 删除 立即付款

                        

                        

                                        
                


回复讨论(解决方案)

前端遍历数据问题

订单表关联订单产品表

order_info 和 order_goods
得出结果集,遍历循环

订单表关联订单产品表

order_info 和 order_goods
得出结果集,遍历循环




我已得出结果集  就是前端遍历出现问题   是个table 怎么玩?

可以先计算订单商品条目数量然后合并单元格之类的

我已经弄出来了,放弃了table,用DIV排的,现在没问题了,,分还是分给大家吧,

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.