Пример #1
0
 public function actionIndex()
 {
     $product_id = intval($_REQUEST['id']);
     $pInfo = Product::model()->getProductInfoById($product_id);
     if (empty($pInfo)) {
         $this->redirect('/?from=no_goods');
         //跳转到首页
     }
     $brandInfo = '';
     if ($pInfo['brand_id']) {
         $brandInfo = Brand::model()->findByPk($pInfo['brand_id']);
     }
     $stock = Product::model()->getProductStock($product_id, $pInfo['is_multiple']);
     $attrList = ProductAttributes::model()->getProductAttrNameList();
     $extendAttrList = ProductExtend::model()->getProductExtendAttrs($product_id);
     $is_like = Like::model()->getLikeStatus($this->user_id, $product_id);
     $cake = Category::model()->getCakeLine($pInfo['cat_id']);
     //获取商品的面包屑
     $viewData = array();
     $viewData['pInfo'] = $pInfo;
     $viewData['brandInfo'] = $brandInfo;
     $viewData['is_like'] = $is_like;
     $viewData['cake'] = $cake;
     $viewData['stock'] = $stock;
     $viewData['attrList'] = $attrList;
     $viewData['extendAttrList'] = $extendAttrList;
     $this->render('item/index', $viewData);
 }
Пример #2
0
 public function actionIndex()
 {
     Yii::import("application.extensions.payment.alipayNotify", true);
     $alipaySubmit = new alipayNotify();
     $html_text = $alipaySubmit->buildRequestHttp(aaa);
     $this->render('/test/index');
     exit;
     echo "<pre>";
     $list = ProductAttributes::model()->findAllByAttributes(array('id' => 2));
     User::find()->where('status=:status', [':status' => User::STATUS_ACTIVATED])->indexBy('id')->all();
     $zine_ids = array(1, 2, 3);
     $list = Yii::app()->byguitar->createCommand()->select('*')->from('bg_zine')->where('id in (' . implode(',', $zine_ids) . ')')->queryAll();
     print_r($list);
     exit;
     echo "this is a test page <br>";
     echo Yii::getVersion();
     exit;
 }
Пример #3
0
 /**
  * 整理购物车商品的详情()
  * @param $product_id
  * @param $type
  */
 public function getCartProductInfoByProductId($product_id, $type)
 {
     if ($type == 1) {
         $info = Tab::model()->findByPk($product_id)->getAttributes();
     } elseif ($type == 2) {
         $info = Zine::model()->findByPk($product_id)->getAttributes();
     } else {
         $info = Product::model()->findByPk($product_id)->getAttributes();
         $stocks = Product::model()->getProductStock($product_id, $info['is_multiple']);
         if ($info['is_multiple'] == 1) {
             $info['sizeids'] = array();
             $attrList = ProductAttributes::model()->getProductAttrNameList();
             if ($stocks) {
                 foreach ($stocks as $row) {
                     $temp = array();
                     $temp['id'] = $row['attr_id'];
                     $temp['quantity'] = $row['quantity'];
                     $temp['attr_name'] = isset($attrList[$row['attr_id']]) ? $attrList[$row['attr_id']] : '';
                     $info['sizes'][$row['attr_id']] = $temp;
                 }
             }
         } else {
             $info['stock'] = $stocks;
         }
     }
     return $info;
 }
Пример #4
0
 public function actionProductAttrDel()
 {
     $res = array('statusCode' => 200, 'message' => '删除成功!');
     try {
         if (empty($_REQUEST['id'])) {
             throw new Exception("数据错误,id不能为空!", 1);
         }
         $flag = ProductAttributes::model()->deleteByPk($_REQUEST['id']);
         if (empty($flag)) {
             throw new exception('删除失败!');
         }
     } catch (Exception $e) {
         $res['statusCode'] = 300;
         $res['message'] = '失败【' . $e->getMessage() . '】';
     }
     $res['callbackType'] = 'reloadTab';
     $res['forwardUrl'] = '/manage/product/Attrlist';
     $this->ajaxDwzReturn($res);
 }