function getCollection($shop_str, $Access_Token) { $collection_Url = 'https://' . SHOPIFY_API_KEY . ':' . SHOPIFY_SECRET . '@' . $shop_str . '/admin/custom_collections.json'; $header = array('Accept: application/json', 'Content-Type: application/json', 'X-Shopify-Access-Token: ' . $Access_Token); $response = http_Curl($collection_Url, NULL, $header); if ($response['status']) { $collections = (array) $response['result']['custom_collections']; $collection_ID = array(); $product_collections = array(); foreach ($collections as $collection) { array_push($collection_ID, $collection['id']); $product_collections[$collection['id']] = array('id' => (string) $collection['id'], 'title' => (string) $collection['title'], 'desc' => (string) $collection['body_html']); } if (!empty($product_collections)) { return array('status' => 1, 'result' => $product_collections, 'IDs' => $collection_ID); } else { return array('status' => 0, 'result' => "No Collection are there!"); } } else { return array('status' => 0, 'result' => $response['error']); } }
function getPages($shop_str, $Access_Token) { $collection_Url = 'https://' . SHOPIFY_API_KEY . ':' . SHOPIFY_SECRET . '@' . $shop_str . '/admin/pages.json'; $header = array('Accept: application/json', 'Content-Type: application/json', 'X-Shopify-Access-Token: ' . $Access_Token); $response = http_Curl($collection_Url, NULL, $header); if ($response['status']) { $pages = (array) $response['result']['pages']; $pages_ID = array(); $pages_a = array(); foreach ($pages as $page) { array_push($pages_ID, $page['id']); $pages_a[$page['id']] = array('id' => (string) $page['id'], 'title' => (string) $page['title']); } if (!empty($pages_a)) { return array('status' => 1, 'result' => $pages_a, 'IDs' => $pages_ID); } else { return array('status' => 0, 'result' => "No Pages are there!"); } } else { return array('status' => 0, 'result' => $response['error']); } }