gnikyt/Basic-Shopify-API

Querying with Danish characters in SKU returns no results

kbubandt opened this issue · 2 comments

Using Danish characters in an sku query (æøåÆØÅ) results in no hits.
If the same query phrase is used in GraphiQL or Insomnia, the result is positive as expected.

Query:
{ products(first: 1, query: "sku:GR-GREGARTEØ-0100") { edges { node { id } } } }

Result:
{"response":{},"body":{"products":{"edges":[]}},"errors":false,"timestamps":[null,1585393004.7812]}

If same query is run in GraphiQL or Insomnia this is the result:
{
"data": {
"products": {
"edges": [
{
"node": {
"id": "gid://shopify/Product/9628048583"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 3,
"actualQueryCost": 3,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 997,
"restoreRate": 50.0
}
}
}
}

And I really cant figure out why?

Hi I will have to look into this... given its characters like that, I have no idea if this is a core php problem with unicode, guzzle, curl, or something else.

@kbubandt Is this still an issue with the newest version? I believe something internally in Guzzle may have resolved this.

I used that SKU on a test store with good results...

<?php

require 'vendor/autoload.php';

use Osiset\BasicShopifyAPI\Options;
use Osiset\BasicShopifyAPI\Session;
use Osiset\BasicShopifyAPI\BasicShopifyAPI;

$options = new Options();
$options->setVersion('2020-01');

$api = new BasicShopifyAPI($options);
$api->setSession(new Session('-----------.myshopify.com', 'dd69e76588e3058b0b8ae1dd7a7b7dn9'));

$x = $api->graph('{ products(first: 1, query: "sku:GR-GREGARTEØ-0100") { edges { node { id, handle } } } }');
print_r($x['body']);

Result:

Osiset\BasicShopifyAPI\ResponseAccess Object
(
    [container] => Array
        (
            [data] => Array
                (
                    [products] => Array
                        (
                            [edges] => Array
                                (
                                    [0] => Array
                                        (
                                            [node] => Array
                                                (
                                                    [id] => gid://shopify/Product/1624265326634
                                                    [handle] => test-product
                                                )

                                        )

                                )

                        )

                )

            [extensions] => Array
                (
                    [cost] => Array
                        (
                            [requestedQueryCost] => 3
                            [actualQueryCost] => 3
                            [throttleStatus] => Array
                                (
                                    [maximumAvailable] => 1000
                                    [currentlyAvailable] => 997
                                    [restoreRate] => 50
                                )

                        )

                )

        )

    [position] => 0
)