PHP code example of atabix / swretail-api-client

1. Go to this page and download the library: Download atabix/swretail-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atabix / swretail-api-client example snippets



use SWRetail\Models\Article;

$article = Article::get(15);

echo $article->getDescription();
echo $article->priceInfo()->getBase();

$article->setAdditionalInfo('Lorem ipsum dolor sid amet.');
$article->update();


use SWRetail\Models\Article;
use SWRetail\Models\Article\Barcode;
use SWRetail\Models\Order;
use SWRetail\Models\Order\Line;
use SWRetail\Models\Relation;
use SWRetail\Models\Type\Price;

$relation = Relation::byCode('K100123');

$order = new Order('87654');

$order->setStatus('created')
    ->setDate('2019-01-28')
    ->setShipTo($relation)
    ->setShippingCost(new Price('4.95'))
    ->setInvoiceTo($relation)
    ->setPaymentMethod('iDeal');
    // Set some more properties, see example doc.

$order->addLine(Line::fromArticle(Article::get(15)));
$order->addLine(Line::fromBarcode(new Barcode('2637485960')));

$orderId = $order->create();
ini
SWRETAIL_ENDPOINT=
SWRETAIL_USERNAME=
SWRETAIL_PASSWORD=