0byt3m1n1
Path:
/
home
/
kassiope
/
www
/
cron
/
[
Home
]
File: shoppingflux.php
<?php namespace ShoppingFeed\Sdk; use ShoppingFeed\Sdk\Api\Order\OrderItemCollection; ini_set('display_errors',1); error_reporting(E_ALL); require_once dirname(__FILE__).'/../vendor/autoload.php'; // Setup credentials to connect to the API, and create session $credential = new Credential\Token('ae50a2cfbbfd0caeb33f799aa6a9a1fc'); $session = Client\Client::createSession($credential); $store = $session->getMainStore(); $store->getName(); // test-store $store->getId(); // 1276 $orderApi = $session->getMainStore()->getOrderApi(); $criteria = [ 'page' => 1, // first page 'limit' => 100, // 20 orders per page 'filters' => [ 'status' => [], // ['shipped', 'cancelled'] we only want orders with shipped or cancelled status 'since' => '2021-09-28T00:00:00+0002', // we only want orders created since (after) 2017-12-01 12:00:00 'until' => '2021-09-30T12:00:00+0002', // we only want orders created until (before) 2018-01-31 12:00:00 ] ]; /* // Retrieve all orders shipped or cancelled foreach($orderApi->getAll($criteria['filters']) as $order) { echo $order->getId(); } // Retrieve all pages of orders shipped or cancelled foreach($orderApi->getPages($criteria) as $orderCollection) { echo $orderCollection->count(); } */ // Retrieve a page of orders shipped or cancelled foreach($orderApi->getPage($criteria) as $order) { echo 'ORDER ID : '.$order->getId(); echo '<br />---------------------<br />'; print_r($order->getShippingAddress()); echo '<br />---------------------<br />'; print_r($order->getBillingAddress()); echo '<br />---------------------<br />'; print_r($order->getPaymentInformation()); echo '<br />---------------------<br />'; print_r($order->getShipment()); echo '<br />---------------------<br />'; //print_r($order->getChannel()); //echo '<br />---------------------<br />'; print_r($order->getStatus()); echo '<br />---------------------<br />'; print_r($order->getReference()); echo '<br />---------------------<br />---------------------<br />'; /* $items = new \ShoppingFeed\Sdk\Api\Order\OrderItemCollection(); print_r($order->getItems($items)); */ /**/ foreach($order->getItems() as $items) { echo 'Ref : '.$items->getReference(); echo '<br />'; echo 'Qte : '.$items->getQuantity(); echo '<br />'; echo 'Prix unit : '.$items->getUnitPrice(); echo '<br />'; echo 'TVA : '.$items->getTaxAmount(); echo '<br />'; echo 'Total prix : '.$items->getTotalPrice(); echo '<br />////////////////////////////////<br />'; } /**/ echo '<br />#######################################<br />'; }