Exemplo n.º 1
0
 /**
  */
 public function getEditArticleInfo()
 {
     $metafield = new \erdiko\shopify\models\Metafield();
     $srcID = $_GET['src_id'];
     $urlID = $_GET['url_id'];
     $titleID = $_GET['title_id'];
     $articleID = $_GET['article_id'];
     $args_src = array("metafield" => array("id" => $srcID, "value" => $_GET['src'], "value_type" => "string"));
     $args_url = array("metafield" => array("id" => $urlID, "value" => $_GET['url'], "value_type" => "string"));
     $args_title = array("metafield" => array("id" => $titleID, "value" => $_GET['title'], "value_type" => "string"));
     $message = "successfully processed the request";
     try {
         $metafield->updateBlogArticleMetaField($articleID, $srcID, $args_src);
         $metafield->updateBlogArticleMetaField($articleID, $urlID, $args_url);
         $metafield->updateBlogArticleMetaField($articleID, $titleID, $args_title);
     } catch (ShopifyApiException $e) {
         $response_headers = $e->getResponseHeaders();
         $message = "Error in editing Blog Article Metafield :: " . $response_headers['http_status_code'] . ":" . $response_headers['http_status_message'];
     } catch (ShopifyCurlException $e) {
         $message = "Error :: Shopify Curl Exception";
     } catch (\Exception $e) {
         $message = $e->getMessage();
     }
     $this->setContent($this->getLayout('message', $message, dirname(__DIR__)));
 }