# Usage
# Available Methods
- Create Order - Creates new order
- Update Order - Updates existing order
- Create or Update Order - Updates or creates a new order
- Update Address - Updates existing orders shipping/billing address
- Update Products - Updates existing orders products
# Create Order
// Import Eračuni plugin
require_once('/bsmart_plugins/autoload.php');
use Bsmart\Eracuni\EracuniOrder;
// Add products to array
$products = array();
$products[] = [
'productName' => 'productName',
'productCode' => 'SKU',
'quantity' => 1,
'price' => 30.90,
];
// Instantiate Eračuni for specific country
$order = new EracuniOrder('IT');
// Create order
$order->create([
'orderNumber' => $random,
'methodOfPayment' => 'cashOnDelivery',
'buyerEmail' => $email,
'buyerName' => $ime,
'buyerStreet' => $naslov_hisna_st,
'buyerPostalCode' => $posta,
'buyerCity' => $kraj,
'buyerPhone' => $phone_full,
'products' => $products
], 'createOnly');
| Field | Value |
|---|---|
methodOfPayment | creditCard / cashOnDelivery |
# Update Order
# Create or Update Order
# Update Order Address
// Import Eračuni plugin
require_once('/home/hitprodu/bsmart_plugins/autoload.php');
use Bsmart\Eracuni\EracuniOrder;
// Instantiate Eračuni for specific country
$order = new EracuniOrder('IT'); // ISO Country code - first parameter
// Update Address
$order->updateAddress([
'orderNumber' => $random,
'buyerEmail' => $email,
'buyerName' => $ime,
'buyerStreet' => $naslov_hisna_st,
'buyerPostalCode' => $posta,
'buyerCity' => $kraj,
'buyerPhone' => $phone_full
]);
# Update Order Products
// Import Eračuni plugin
require_once('/home/hitprodu/bsmart_plugins/autoload.php');
use Bsmart\Eracuni\EracuniOrder;
// Add products to array
$products = array();
$products[] = [
'productName' => 'productName',
'productCode' => 'SKU',
'quantity' => 1,
'price' => 30.90,
];
// Instantiate Eračuni for specific country
$order = new EracuniOrder('IT'); // ISO Country code - first parameter
// Update order products
$order->updateProducts([
'orderNumber' => $random,
'products' => $products
]);
# Products Array
Holds an array of product items. Product SKU will be provided by eračuni user or you can use the getProducts.php helper file to search products by keywords. List of predefined SKUs for warranty, priority and surprise product can be found in the SKU Reference documentation.
/**
* Add products to array
*/
$products = array();
$products[] = [
'productName' => $ime_izdelka . " [" . $item_color . "] [" . $item_size . "]",
'productCode' => 'productSKU',
'quantity' => $quantity,
'price' => $vrednost,
];
if (isset($_POST['garancija'])) {
$products[] =[
'productName' => $summary_3,
'productCode' => 'warrantySKU',
'quantity' => 1,
'price' => $vrednost_garancije,
];
}
if (isset($_POST['prioritetna'])) {
$products[] =[
'productName' => $summary_4_1,
'productCode' => 'prioritySKU',
'quantity' => 1,
'price' => $vrednost_prioritetne,
];
}
| Field | Value |
|---|---|
productName | string required |
productCode | string required - Leave empty string '' if product is not associated with any SKU (for example PDF books and other digital products) |
quantity | int |
price | int / float |
← Configuration Helpers →