Skip to content

Commit

Permalink
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/ShopifyResource.php
Original file line number Diff line number Diff line change
@@ -562,8 +562,9 @@ public function getLink($responseHeaders, $type='next'){
}

if(!empty($responseHeaders['link'])) {
if (stristr($responseHeaders['link'][0], '; rel="'.$type.'"') > -1) {
$headerLinks = explode(',', $responseHeaders['link'][0]);
var_dump($responseHeaders['link']);
if (stristr($responseHeaders['link'], '; rel="'.$type.'"') > -1) {
$headerLinks = explode(',', $responseHeaders['link']);
foreach ($headerLinks as $headerLink) {
if (stristr($headerLink, '; rel="'.$type.'"') === -1) {
continue;
@@ -589,15 +590,25 @@ public function getNextLink(){
return $this->nextLink;
}

public function getUrlParams($url) {
if ($url) {
$parts = parse_url($url);
return $parts['query'];
}
return '';
}

public function getNextPageParams(){
$nextPageParams = [];
parse_str($this->getNextLink(), $nextPageParams);
$nextPageLink =

parse_str($this->getUrlParams($this->getNextLink()), $nextPageParams);
return $nextPageParams;
}

public function getPrevPageParams(){
$nextPageParams = [];
parse_str($this->getPrevLink(), $nextPageParams);
parse_str($this->getUrlParams($this->getPrevLink()), $nextPageParams);
return $nextPageParams;
}
}

0 comments on commit 763cf8f

Please sign in to comment.