/** * Get Metafields */ public function getMetafields() { $metafield = new \erdiko\shopify\models\Metafield(); $data = $metafield->getMetafields(); $this->setTitle('Shopify Metafields'); $this->setContent($this->getLayout('json', $data)); }
/** * Get Metafields */ public function getMetafields() { $metafield = new \erdiko\shopify\models\Metafield(); $message = ""; $isError = FALSE; try { $data = $metafield->getMetafields(); } catch (ShopifyApiException $e) { $response_headers = $e->getResponseHeaders(); $message = "Error in getting Metafields :: " . $response_headers['http_status_code'] . ":" . $response_headers['http_status_message']; $isError = TRUE; } catch (ShopifyCurlException $e) { $message = "Error :: Shopify Curl Exception"; $isError = TRUE; } catch (\Exception $e) { $message = $e->getMessage(); $isError = TRUE; } if (!$isError) { $this->setTitle('Shopify Metafields'); $this->setContent($this->getLayout('json', $data)); } else { $this->setContent($this->getLayout('message', $message, dirname(__DIR__))); } }