Commit 9e6e908634285565b4e260ad8f398ce0b080b56f

Authored by Administrator
1 parent 52e22ec2

add similar products

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
controllers/OrderController.php
@@ -176,6 +176,7 @@ @@ -176,6 +176,7 @@
176 176
177 if (!empty( $model )) { 177 if (!empty( $model )) {
178 $model->count += $count; 178 $model->count += $count;
  179 + $model->removed = false;
179 } else { 180 } else {
180 $model = new OrderProduct(); 181 $model = new OrderProduct();
181 182
@@ -186,6 +187,7 @@ @@ -186,6 +187,7 @@
186 $model->sku = $productVariant->sku; 187 $model->sku = $productVariant->sku;
187 $model->price = $productVariant->price; 188 $model->price = $productVariant->price;
188 $model->count = $count; 189 $model->count = $count;
  190 + $model->removed = false;
189 } 191 }
190 \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; 192 \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
191 193
@@ -437,6 +439,7 @@ @@ -437,6 +439,7 @@
437 { 439 {
438 $model = OrderProduct::findOne($id); 440 $model = OrderProduct::findOne($id);
439 $model->removed = true; 441 $model->removed = true;
  442 + $model->count = 0;
440 $model->save(); 443 $model->save();
441 $order = Order::findOne($order_id); 444 $order = Order::findOne($order_id);
442 $order->totalRecount(); 445 $order->totalRecount();