diff --git a/admin/redirectFromJinxxy.php b/admin/redirectFromJinxxy.php index 91db936..a1142cc 100644 --- a/admin/redirectFromJinxxy.php +++ b/admin/redirectFromJinxxy.php @@ -31,67 +31,40 @@ $productData; $data = json_decode($_POST["data"]); -$apolloState = $data->props->pageProps->__APOLLO_STATE__; -$rootData = $data->props->pageProps->__APOLLO_STATE__->ROOT_QUERY; +print_r($data); -// getting the product data -foreach ($rootData as $key => $value) { - if (strpos($key, 'product') !== false) { - $temp = $value->__ref; - - foreach ($apolloState as $key => $value) { - if (strpos($key, $temp) !== false) { - $productData = $value; - } - } - } -} +$product = $data->product; +$seller = $data->seller; -// getting the user data -foreach ($apolloState as $key => $value) { - if (strpos($key, $productData->user->__ref) !== false) { - $userData = $value; - } -} - -// getting user profilePicture -foreach ($apolloState as $key => $value) { - if (strpos($key, $userData->profile_image->__ref) !== false) { - $creator_pb = $value->url; - } -} - -foreach ($apolloState as $key => $value) { - if (strpos($key, $productData->cover->__ref) !== false) { - $content_image = $value->url; - } -} // set creator name -$creator_name = $userData->name; +$creator_name = $seller->name; // set creator jinxxy url -$creator_jinxxyURL = "https://jinxxy.com/" . $userData->username; +$creator_jinxxyURL = $seller->url; + +// set creator pb +$creator_pb = $seller->image; // set content name -$content_name = $productData->name; +$content_name = $product->name; // set content price -$content_price = $productData->base_price; +$content_price = $product->base_price; // set procuct url -$content_url = "https://jinxxy.com/" . $data->props->pageProps->username . "/" . $data->props->pageProps->url_slug; +$content_url = $product->url; // set no rating $content_rating = "null"; // currency type -$currency_currency = strtolower($productData->currency_code); +$currency_currency = $product->currencySymbol; $databaseConnection = new mysqli("localhost", "furatalog_usr", "1yRNpaUtXu[cw@-m", "furatalog"); -$result = $databaseConnection->query("SELECT * FROM `currency` WHERE currency=\"" . $currency_currency . "\";"); +$result = $databaseConnection->query("SELECT * FROM `currency` WHERE symbol=\"" . $currency_currency . "\";"); $content_currency_id = $result->fetch_assoc()["id"];