Commit 8015d9d9565eb4e4ccd992d5e20f516409686ebb

Authored by Anastasia
1 parent 24eda961

incust on frontend

Showing 1 changed file with 11 additions and 1 deletions   Show diff stats
controllers/OrderController.php
... ... @@ -10,6 +10,7 @@
10 10 use artbox\order\models\OrderProduct;
11 11 use artbox\order\labels\models\Payment;
12 12 use backend\incust\components\Incust;
  13 + use common\models\IncustLog;
13 14 use Yii;
14 15 use artbox\order\models\Order;
15 16 use yii\web\Controller;
... ... @@ -234,7 +235,16 @@
234 235 )
235 236 )) {
236 237 OrderProduct::saveItems(\Yii::$app->request->post('OrderProduct'), $id);
237   - if ($model->paid and class_exists(Incust::className()) and $model->bonuses_add == null and $model->incust) {
  238 +
  239 + if ($model->paid and class_exists(Incust::className()) and $model->incust) {
  240 + $incustAdd = IncustLog::find()->where(['status' => IncustLog::STARUS_ADD])->andWhere(['order_id' => $model->id]);
  241 + if ($incustAdd !== null){
  242 + return $this->redirect(
  243 + [
  244 + 'index',
  245 + ]
  246 + );
  247 + }
238 248 /**
239 249 * @var \backend\incust\components\Incust $incust;
240 250 */
... ...