public function actionApicheckout() { $data = $_GET; if (isset($data['token'])) { $ApiFunctions = new ApiFunctions(); if ($res = $ApiFunctions->getCart($data['token'])) { $order = ''; $merchant_id = $res[0]['merchant_id']; foreach ($res as $val) { $temp = json_decode($val['raw_order'], true); $temp_1 = ''; if (is_array($temp) && count($temp) >= 1) { $temp_1['row'] = $val['id']; $temp_1['row_api_id'] = $val['id']; $temp_1['merchant_id'] = $val['merchant_id']; $temp_1['currentController'] = "store"; foreach ($temp as $key => $value) { $temp_1[$key] = $value; } $order[] = $temp_1; } } //unset($_SESSION); $_SESSION['api_token'] = $data['token']; $_SESSION['currentController'] = "store"; $_SESSION['kr_merchant_id'] = $merchant_id; $_SESSION['kr_delivery_options']['delivery_type'] = $data['delivery_type']; $_SESSION['kr_delivery_options']['delivery_date'] = $data['delivery_date']; $_SESSION['kr_delivery_options']['delivery_time'] = $data['delivery_time']; $_SESSION['kr_item'] = $order; $redirect = Yii::app()->getBaseUrl(true) . "/store/checkout"; header("Location: " . $redirect); $this->render('error', array('message' => t("Please wait while we redirect you"))); } else { $this->render('error', array('message' => t("Token not found"))); } } else { $this->render('error', array('message' => t("Token is missing"))); } }