예제 #1
0
 public function pdetail()
 {
     if (!isset($_REQUEST['id'])) {
         exit('error can not found the product');
     }
     $map['token'] = get_token();
     $map['id'] = $_REQUEST['id'];
     $pd = new ProductModel();
     $detail = $pd->productDetail($map);
     $detail['img1'] = get_cover_url($detail['img1']);
     $detail['img2'] = get_cover_url($detail['img2']);
     $detail['img3'] = get_cover_url($detail['img3']);
     // exit(json_encode($detail));
     $this->assign('detail', $detail);
     $this->_footer();
     $this->display(ONETHINK_ADDON_PATH . 'WeiSite/View/default/Product/' . 'pdetail.html');
 }
예제 #2
0
 public function cartList()
 {
     $pd = new ProductModel();
     $goods = unserialize(cookie('goods'));
     $order = array();
     $sum = 0;
     if ($goods !== null && !empty($goods)) {
         foreach ($goods as $x) {
             $map['id'] = $x['id'];
             //商品id
             $cell = $pd->productDetail($map);
             //通过商品id 获取商品详情
             $cell['img1'] = get_cover_url($cell['img1']);
             $cell['count'] = $x['count'];
             $order[] = $cell;
             $sum += $cell['price'] * $x['count'];
         }
     }
     $this->assign('sum', $sum);
     $this->assign('cartList', $order);
     $this->display('cartList');
 }