/**
  * Получает список товаров в одном из заказов контрагента
  * @param intger $id - это ид заказа
  * @return type
  */
 public function actionConfirmCheckoutByAdmin($id)
 {
     $totalPrice = OrdersQuery::totalPriceForOrder($id);
     $order = Orders::findOne($id);
     $searchModel = new OrderedProductSearch();
     $dataProvider = $searchModel->searchAttachToOrderWithId(Yii::$app->request->queryParams, $id);
     return $this->render('confirmCheckoutByAdmin', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'totalPrice' => $totalPrice, 'order' => $order]);
 }
Exemplo n.º 2
0
 public function actionRepeat($id)
 {
     $orderId = $id;
     $totalPrice = OrdersQuery::totalPriceThis($id);
     $order = Orders::findOne($orderId);
     $searchModel = new OrderedProductSearch();
     $dataProvider = $searchModel->searchAttachToTheOrder($id, Yii::$app->request->queryParams);
     $validOrder = true;
     $orderedProducts = $dataProvider->models;
     foreach ($orderedProducts as $orderdedProduct) {
         if (!$orderdedProduct->isProduct) {
             $validOrder = false;
         }
     }
     if ($dataProvider->count < $dataProvider->totalCount) {
         $validOrder = false;
     }
     return $this->render('repeat', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'totalPrice' => $totalPrice, 'order' => $order, 'validOrder' => $validOrder]);
 }