mobly/buscape-sdk

Buscape Seller Integration PHP-SDK

v0.2.10 2018-07-17 19:01 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:39:16 UTC


README

Full import

To run a full proccess example.

<?php

require "vendor/autoload.php";

use Mobly\Buscape\Sdk\Client;
use Mobly\Buscape\Sdk\Collection\ProductCollection;

$collection = new ProductCollection();

// Maybe can be have more mandatory fields
$products = [
    [
        'sku' => 'AAA-123',
        'title' => 'Product Title One'
    ],
    [
        'sku' => 'AAA-123',
        'title' => 'Product Title Two'
    ]
];

foreach ($products as $product) {
    $collection->add($product);
}

$api = new Client([
    'app_token' => 'your_token',
    'auth_token' => 'your_auth_token',
]);

$response = $api->loadProducts($collection);

print_r($response);

Partial import

To run a partial proccess example.

$collection = new InventoryCollection();
foreach ($products as $product) {
    $buscapeProduct = new Inventory($product->toArray());
    $collection->add($buscapeProduct);
}

$api = new Client([
    'app_token' => 'your_token',
    'auth_token' => 'your_auth_token',
]);

$response = $api->inventoryUpdate($collection);

print_r($response);