public function actionDelete($id)
    {
        if (!empty($id)) {
            if ($id != OrderStatus::STATUS_INCOMPLETE && $id != OrderStatus::STATUS_CONFIRMED) {
                $status = $this->findModel($id);
                if (!empty($status)) {
                    \Yii::$app->session->setFlash('success', Yii::t('cart', 'The status was successfully deleted.'));
                    $status->delete();
                }
            } else {
                \Yii::$app->session->setFlash('success', Yii::t('cart', 'Removing this status will break cart functionality.'));
            }
            return $this->redirect(['index']);
        }

        throw new NotFoundHttpException();
    }
public function actionDelete($id)
    {
        if (!empty($id)) {
            if ($id != OrderStatus::STATUS_INCOMPLETE && $id != OrderStatus::STATUS_CONFIRMED) {
                $status = $this->findModel($id);
                if (!empty($status)) {
                    \Yii::$app->session->setFlash('success', Yii::t('cart', 'The status was successfully deleted.'));
                    $status->delete();
                }
            } else {
                \Yii::$app->session->setFlash('success', Yii::t('cart', 'Removing this status will break cart functionality.'));
            }
            return $this->redirect(['index']);
        }

        throw new NotFoundHttpException();
    }
public function actionDelete ( $ id ) { if ( ! empty ( $ id ) ) { if ( $ id != OrderStatus :: STATUS_INCOMPLETE && $ id != OrderStatus :: STATUS_CONFIRMED ) { $ status = $ this -> findModel ( $ id ) ; if ( ! empty ( $ status ) ) { \ Yii :: $ app -> session -> setFlash ( 'success' , Yii :: t ( 'cart' , 'The status was successfully deleted.' ) ) ; $ status -> delete ( ) ; } } else { \ Yii :: $ app -> session -> setFlash ( 'success' , Yii :: t ( 'cart' , 'Removing this status will break cart functionality.' ) ) ; } return $ this -> redirect ( [ 'index' ] ) ; } throw new NotFoundHttpException ( ) ; }
Deletes an existing OrderStatus model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed
@throws Exception if user try to delete default statuses.
@throws NotFoundHttpException if there is not $id.
Deletes an existing OrderStatus model . If deletion is successful the browser will be redirected to the index page .