Пример #1
0
 /**
  * 删除
  */
 public function actionDelete()
 {
     $props_id = $this->get('props_id');
     $result = GoodsTypeProps::model()->deleteAll('props_id = :props_id', array(':props_id' => $props_id));
     if (!$result) {
         $GoodsTypePropsValue = new GoodsTypePropsValue();
         $this->message('error', CHtml::errorSummary($GoodsTypePropsValue), $this->createUrl('index'));
     }
     GoodsTypePropsRelation::model()->deleteAll('props_id = :props_id', array(':props_id' => $props_id));
     $result = GoodsTypePropsValue::model()->deleteAll('props_id = :props_id', array(':props_id' => $props_id));
     if ($result) {
         $this->message('success', '删除成功', $this->createUrl('index'));
     } else {
         $GoodsTypePropsValue = new GoodsTypePropsValue();
         $this->message('error', CHtml::errorSummary($GoodsTypePropsValue), $this->createUrl('index'));
     }
 }
Пример #2
0
 /**
  * 类型删除
  */
 public function actionDelete()
 {
     $type_id = $this->get('type_id');
     //商品类型主表修改
     $type_attributes['disabled'] = 'true';
     $type_attributes['lastmodify'] = time();
     $result = GoodsType::model()->updatebypk($type_id, $type_attributes);
     if (!$result) {
         $GoodsType = new GoodsType();
         $this->message('error', CHtml::errorSummary($GoodsType), $this->createUrl('index'));
     }
     //类型-品牌
     $result = TypeBrand::model()->deleteAll('type_id = :type_id', array(':type_id' => $type_id));
     if (!$result) {
         $TypeBrand = new TypeBrand();
         $this->message('error', CHtml::errorSummary($TypeBrand), $this->createUrl('index'));
     }
     //类型-扩展属性
     $result = GoodsTypePropsRelation::model()->deleteAll('type_id = :type_id', array(':type_id' => $type_id));
     if (!$result) {
         $GoodsTypePropsRelation = new GoodsTypePropsRelation();
         $this->message('error', CHtml::errorSummary($GoodsTypePropsRelation), $this->createUrl('index'));
     }
     //类型-规格
     $result = GoodsTypeSpec::model()->deleteAll('type_id = :type_id', array(':type_id' => $type_id));
     if (!$result) {
         $GoodsTypeSpec = new GoodsTypeSpec();
         $this->message('error', CHtml::errorSummary($GoodsTypeSpec), $this->createUrl('index'));
     }
     $this->message('success', '删除成功', $this->createUrl('index'));
 }