/**
  * Ajax
  */
 public function actionSubmittedOrdersByAjax()
 {
     if (Yii::$app->request->isAjax) {
         /* Yii::$app->request->post() = {goodsID : quantity} */
         $goodsIdList = Yii::$app->request->post();
         if (!empty($goodsIdList)) {
             $orderID = Orders::saveOrder($goodsIdList);
             OrderItems::saveOrderItems($orderID, $goodsIdList);
             $link = \Yii::$app->homeUrl . '/index.php?r=orders/view&id=' . $orderID;
             $data = array('status' => 'ok', 'link' => $link);
             echo \yii\helpers\Json::encode($data);
         } else {
             $data = array('status' => 'unok');
             echo \yii\helpers\Json::encode($data);
         }
     }
 }