Esempio n. 1
0
 /**
  * 商品规格
  */
 public function actionSpec()
 {
     $goods_id = $this->get('goods_id');
     $goods_row = Goods::model()->find('goods_id = :goods_id', array(':goods_id' => $goods_id));
     if ($_POST) {
         $product_attributes = $this->post('Product');
         $Product = new Products();
         $result = $Product->createProduct($goods_id, $goods_row, $product_attributes);
         if ($result) {
             $this->message('success', '编辑成功', $this->createUrl('index'));
         } else {
             $this->message('error', '编辑失败', $this->createUrl('index'));
         }
     }
     //商品规格
     $GoodsTypeSpec = new GoodsTypeSpec();
     $items = $GoodsTypeSpec->TypeSpecValue($goods_row['type_id']);
     $spec_list_t = $GoodsTypeSpec->ProductSpecList($goods_id);
     $spec_list = array();
     foreach ($spec_list_t as $v) {
         $spec_list[$v['spec_id']] = $v;
     }
     //货品列表
     $product_list = Products::model()->findAll('goods_id = :goods_id AND spec_desc <> :spec_desc AND disabled = :disabled', array(':goods_id' => $goods_id, ':spec_desc' => '', ':disabled' => 'false'));
     echo $this->render('spec', array('items' => $items, 'spec_list' => $spec_list, 'goods_row' => $goods_row, 'product_list' => $product_list));
 }