cakephp - Shopify API getting order by name or order_number -


im using plugin cakephp make calls obtain orders. can call orders fields, wondering how have make call orders name or order_number? here source call shopify. authenticated , everything:

public function call($method, $path, $params=array())     {         if (!$this->isauthorized())             return;         $password = $this->is_private_app ? $this->secret : md5($this->secret.$this->shopifyauth->token);         $baseurl = "https://{$this->api_key}:$password@{$this->shopifyauth->shop_domain}/";          $url = $baseurl.ltrim($path, '/');         $query = in_array($method, array('get','delete')) ? $params : array();         $payload = in_array($method, array('post','put')) ? stripslashes(json_encode($params)) : array();     $request_headers = in_array($method, array('post','put')) ? array("content-type: application/json; charset=utf-8", 'expect:') : array();     $request_headers[] = 'x-shopify-access-token: ' . $this->shopifyauth->token;         list($response_body, $response_headers) = $this->curl->httprequest($method, $url, $query, $payload, $request_headers);     $this->last_response_headers = $response_headers;     $response = json_decode($response_body, true);          if (isset($response['errors']) or ($this->last_response_headers['http_status_code'] >= 400))             throw new shopifyapiexception($method, $path, $params, $this->last_response_headers, $response);          return (is_array($response) , (count($response) > 0)) ? array_shift($response) : $response;     }      private function shopapicalllimitparam($index)     {         if ($this->last_response_headers == null)         {             return 0;         }         $params = explode('/', $this->last_response_headers['http_x_shopify_shop_api_call_limit']);         return (int) $params[$index];     } 

...and code makes get call:

// want id , title of collections             $fields = "fields=name,id,status,financial_status,fulfillment_status,billing_address,customer";             // list of collections             $custom_collections = $this->shopifyapi->call('get', "/admin/orders.json", $fields);             $this->set('collections', $custom_collections); 

i think i'm missing place can put conditions call orders. i've read api documentation can't seem answer.

i've tried putting ?name=%231001 on url after .json try , order #1001, brings empty array.

then tried ?order_number=1001 brings me every order 1001 d: confusing, me?

thanks in advance.

well found out can order using name or order_number. property not listed on documentation reason. in url, if using language, have add in admin/order.json?name=%2310001&status=any order 10001 add order_number after %23. saw on forum in shopify university, implementing wrong on code. if using cakephp shopify plugin me did add on $field ?name=%23". number ."&status=any";

ill leave code here:

    $this->layout = 'main';  $order_number = "18253";  $fields = "name=%23". $order_number ."&status=any";  $order = $this->shopifyapi->call('get', "/admin/orders.json", $fields);    if (!empty($order)) {      $this->set('order', $order);       } else {        $this->session->setflash('<button type="button" class="close" data-dismiss="alert" aria-label="close"><span aria-hidden="true">&times;</span></button> no existe el numero de orden ingresado.','default',array('class' => 'alert alert-danger alert-dismissible', 'type' => 'alert'));      } 

hope helps :p


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -