Quantcast
Viewing all articles
Browse latest Browse all 11091

PHP adapter, "new Session", and private apps by selva

Hi everyone,

 I m new to shopify , and i installed one private app, now i m trying to excute that app. here is my code:

<?php
require_once 'lib/shopify.php';
$t="4226b767fd10efdcbe234ab0c449eda6";
$sc = new ShopifyClient("https-selvar-myshopify-com.myshopify.com", $t, API_KEY, SECRET);
if(!isset($t))
{
if(!isset($_GET['signature']))
{
  	$url = $sc->getAuthorizeUrl("read_orders");
	header('Location: '.$url);
}
if(isset($_GET['code']))
{
	$accTok = $sc->getAccessToken($_GET['code']);
	echo "token=".$accTok;exit;
	$orders = $sc->call('GET', 'admin/orders.json', array('published_status'=>'published'));
	foreach($orders as $order) {
   	echo $order['id'];
    	echo $order['email'];
}
}
}
if(isset($t))
{
	$orders = $sc->call('GET', 'admin/orders.json', array('published_status'=>'published'));
	foreach($orders as $order) {
	echo 'Order id:';
    	echo $order['id'];
	echo '<br/>';
	echo 'Email:';
    	echo $order['email'];
	echo '<br/>';
	echo 'Currency:';
    	echo $order['currency'];
	echo '<br/>';
}

}
?>

and its my output:

Order id:258109471
Email:sasik55@yahoo.in
Currency:INR
Order id:258108403
Email:ss_selva@yahoo.in
Currency:INR
Order id:257721475
Email:rajaselva.csc@gmail.com
Currency:INR

So it will display coressponding order id,email and currency. If  i put
echo $order['currency'];
It will display undefined index , and also phone,address..will display undefined index.
but i m need is, product details(name,type,..etc),customer details(address) and invoice(price,total,vat num,discount,shipping..etc).. 

I dont know what is the best way.. If anyone can help me..

Thanks in advance!.


Viewing all articles
Browse latest Browse all 11091

Trending Articles