Getting Magento 1 orders by date range - rutgerkirkels/ShopConnectors GitHub Wiki

Access to the Magento 1 API is granted by a key and a password.

<?php

use \rutgerkirkels\ShopConnectors\Entities\Credentials\CredentialsFactory;
use \rutgerkirkels\ShopConnectors\Connectors\ConnectorFactory;
use \rutgerkirkels\ShopConnectors\Models\DateRange;

// Build the credentials object
$credentials = CredentialsFactory::build('MagentoV1')
    ->setKey('<your_key>')
    ->setPassword('your_password');

// Build the connector object
$connector = ConnectorFactory::build('MagentoV1', '<MAGENTO_HOSTNAME>', $credentials);

// Determine the date range
$dateRange = new DateRange(new DateTime('2018-01-01'), new DateTime('2018-01-03'));

// Retrieve the orders
$orders = $connector->getOrdersByOrderDate($dateRange);

?>
⚠️ **GitHub.com Fallback** ⚠️