Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal offset "product" using paging with limit & offset filter #24

Open
alihamza1214 opened this issue Dec 19, 2017 · 0 comments
Open

Comments

@alihamza1214
Copy link

When using paging and no products found for next iteration, system does not return "0" or "null" response instead generates error. I have fixed it by adding a check in "Endpoint/Product/Response/GetProducts.php"

protected function processDecodedResponse(array $responseData)
{
parent::processDecodedResponse($responseData);

    $this->products = new ProductCollection([]);
    if($responseData['Body']['Products']==""){   //my check
        return 0;
    }else{
        if (isset($this->body[static::PRODUCTS_KEY])) {
            if (isset($this->body[static::PRODUCTS_KEY][static::PRODUCT_KEY][Product::SELLER_SKU])) {
                $products = [ $this->body[static::PRODUCTS_KEY][static::PRODUCT_KEY] ];
            } else {
                $products = $this->body[static::PRODUCTS_KEY][static::PRODUCT_KEY];
            }
            foreach ($products as $product) {
                $this->products->add(new Product($product));
            }
        }
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant