You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HI @bogdanghervan i create this function to get the code from the api /** * Get the link from the header so we can browser the api * * @param string $link_header * @return string */ private function getCodeFromLinkHeader(string $link_header){ //Check the header for the link $str = array_values(array_slice(explode('/', $link_header), -1, 1, true)); //Cechk if rel="next" is no longer in the link we can break the loop. if(strpos($str[0], 'rel="next"') === false){ return false; } $code_part = substr($str[0], strpos($str[0], 'page_info') + 10); if(strrchr($code_part, '?')){ $code = substr($code_part, 0, strpos($code_part, strrchr($code_part, '?'))); } if(strrchr($code_part, '>')){ $code = substr($code_part, 0, strpos($code_part, strrchr($code_part, '>'))); } return $code; }
Then i call the function with this: $this->getCodeFromLinkHeader($this->api_response->getHeader('link')[0]);
And to get the api response i use Shopify\Service\ProductService->getLastResponse() to set the api_response.
Every Services class has the getLastReponse function to get the headers.
Shopify has removed support for page-based pagination and enforces that everybody moves to cursor-paged pagination.
The library doesn't seem to provide a way to access the response headers, at least when using the services.
The text was updated successfully, but these errors were encountered: