/** * */ public function actionPreSync() { if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; $post = Yii::$app->request->post(); $ebayListing = new EbayListing($post['ebayID']); $preListingInfo = $ebayListing->getPreListingInfo(); if (!isset($preListingInfo['Error'])) { $result['status'] = 'success'; $result['message'] = 'Connection Success'; $result['data'] = $preListingInfo['data']; $result['totalPages'] = $preListingInfo['totalPages']; } else { $result['status'] = 'error'; $result['message'] = 'Follow errors:' . "<br>"; foreach ($preListingInfo['Error'] as $error) { $result['message'] .= $error . "<br>"; } } return $result; //$result['status']='error'; } else { //echo Json::encode("NOT AJAX!Denied"); return false; } }
public function actionItemPic() { if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; $post = Yii::$app->request->post(); $ebayListing = new EbayListing($post['ebayID']); $itemPicUrl = $ebayListing->getItemPicUrl($post['itemID']); $transaction = $this->findTransaction($post['transactionID']); $transaction->image = $itemPicUrl; if ($transaction->save()) { return $itemPicUrl; } } }
public function actionSyncListing($id) { $request = Yii::$app->request; if ($request->isAjax) { $ebayListing = new EbayListing($id); $syncResult = $ebayListing->syncListings(true); echo Json::encode($syncResult); } else { echo Json::encode("NOT AJAX!Denied"); } }