php-shopify icon indicating copy to clipboard operation
php-shopify copied to clipboard

ErrorException : Undefined index: ApiUrl

Open alpesh-savitriya opened this issue 6 years ago • 2 comments

Hi when i find customer like $customer = $shopify->Customer->search("email:"any email"); than it will give me exception like

ErrorException : Undefined index: ApiUrl at /home/ubuntu/sites/staging.api.brewchime.com/vendor/phpclassic/php-shopify/lib/ShopifyResource.php:122 118| $this->id = $id; 119| 120| $config = ShopifySDK::$config; 121|

122| $this->resourceUrl = ($parentResourceUrl ? $parentResourceUrl . '/' : $config['ApiUrl']) . $this->getResourcePath() . ($this->id ? '/' . $this->id : ''); 123| 124| if (isset($config['AccessToken'])) { 125| $this->httpHeaders['X-Shopify-Access-Token'] = $config['AccessToken']; 126| } elseif (!isset($config['ApiKey']) || !isset($config['Password'])) {

Exception trace:

1 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Undefined index: ApiUrl", "/home/ubuntu/sites/staging.api.brewchime.com/vendor/phpclassic/php-shopify/lib/ShopifyResource.php", [""]) /home/ubuntu/sites/staging.api.brewchime.com/vendor/phpclassic/php-shopify/lib/ShopifyResource.php:122

2 PHPShopify\ShopifyResource::__construct() /home/ubuntu/sites/staging.api.brewchime.com/vendor/phpclassic/php-shopify/lib/ShopifySDK.php:289


So how can i fix this issue.

alpesh-savitriya avatar Aug 06 '19 10:08 alpesh-savitriya

@alpesh-savitriya Please show your source code.

tareqtms avatar Aug 08 '19 04:08 tareqtms

`

$shopifyClient = new ShopifySDK([ 'ShopUrl' => env('SHOPIFY_SHOP_URL'), 'ApiKey' => env('SHOPIFY_API_KEY'), 'Password' => env('SHOPIFY_PASSWORD'), ]);

$params = array( 'status' => 'cancelled', 'created_at_min' => '2016-06-25T16:15:47-04:00', 'fields' => 'id,line_items,name,total_price' );

$orders = $shopifyClient->Order->get($params);

`

alihamza avatar Aug 22 '19 22:08 alihamza