echo "Pixel Successfully Installed"; } if (isset($_POST['method']) && $_POST['method'] == 'uninstallPixels' && isset($_SESSION['shop'])) { require_once 'config.php'; require_once 'functions.php'; require_once "shopify.php"; $response = checkShopExists($_SESSION['shop']); if ($response['status'] == 1) { $token = $response['result']['token']; } else { echo "Shop Doesnot exists"; die; } if (isset($token) && $token != "") { $config = array('client_Id' => APIKEY, 'redirect_uri' => REDIRECT_URL, 'client_Secret' => SECRET, 'url' => $_SESSION['shop']); $productFeed = new Shopify($config); $response = $productFeed->setAccessToken($token); if ($response['status']) { } else { echo $response['error']; die; } /* echo "<pre>"; print_r($productFeed); */ } //$pixel = $_POST['dPixel']; //$catalog = $_POST['dCatalog']; $status = 0; $data = array('store_URL' => $_SESSION['shop'], 'status' => $status); $response = updateStatus($data); $themescript = "pixelTheme.liquid";
protected function setUp() { Shopify::setup('9ba1eeb66cbb1f0ce0c61f98d935cc94', 'b579f7bcadfb85effab7d92ddb9702aa'); $this->api = new Shopify('stroman-huels-and-bartoletti1621.myshopify.com', '1305780988', '112690b2ae75e7876ad6e2ae6d3d78cb', 'ae98bcf86ce3dd661d48e18251ba3d3b'); }
<?php require_once 'shopify.php'; if ($_GET && isset($_GET["query"])) { $query = $_GET["query"]; $str = explode("\$#\$", base64_decode($query)); } else { echo json_encode("{'error':'Invalid Request'}"); exit; } $framework = $str[0]; if ($framework == "shopify") { $request = getallheaders(); if (!isset($request["X-Shopify-Hmac-Sha256"])) { echo json_encode("{'error':'Untrusted source'}"); exit; } $event = $str[1]; $key = $str[2]; $secret = $str[3]; $from = $str[4]; $threshold = $str[5]; $storename = $str[6]; $ownerno = $str[7]; $data = json_decode(file_get_contents('php://input'), true); $shop = new Shopify(); echo $shop->handler($event, $key, $secret, $from, $data, $threshold, $storename, $ownerno); } else { echo json_encode("{'error':'No Framework found'}"); }
static function setup($api_key, $api_secret, $options = array()) { self::$api_key = $api_key; self::$api_secret = $api_secret; }
<?php require_once 'shopify.php'; try { // setup Shopify::setup('9ba1eeb66cbb1f0ce0c61f98d935cc94', 'b579f7bcadfb85effab7d92ddb9702aa'); // do we have a shop to work with? if (empty($_GET['shop'])) { // authenticate if (!empty($_POST['shop'])) { header('Location: https://' . $_POST['shop'] . '/admin/api/auth?api_key=' . Shopify::$api_key); exit; } echo '<form action="demo.php" method="post"><label for="shop">Shop:</label> <input type="text" name="shop"> <input type="submit" value="Authenticate" /></form>'; } else { // run demo $api = new Shopify($_REQUEST['shop'], $_REQUEST['timestamp'], $_REQUEST['signature'], $_REQUEST['t']); // load shop $shop = $api->shop(); echo '<h1>' . $shop['name'] . '</h1>'; echo '<h2>' . $api->products->count() . ' Products</h2>'; echo '<ul>'; foreach ($api->products() as $product) { echo '<li>' . $product['id'] . ': ' . $product['title']; echo '<ul>'; foreach ($product->variants as $variant) { echo '<li>$' . $variant['price'] . ': ' . $variant['title'] . ' (' . $variant['id'] . ')</li>'; } echo '</ul></li>'; } echo '</ul>'; }
static function shop(Shopify $api) { $data = $api->call('shop'); return new self($api, $data['shop']); }