PHP code example of ossbrownie / carts-guru
1. Go to this page and download the library: Download ossbrownie/carts-guru 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/ */
ossbrownie / carts-guru example snippets
$cartsGuru = new CartsGuru(
new HTTPClient(
new CurlClient(),
new Config(array(
'apiAuthKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
))
),
'site-id-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
);
$item = new Item(array(
'id' => 'test-item-0008',
'label' => 'product',
'quantity' => 1,
'totalATI' => 200,
'totalET' => 150,
'url' => 'http://site.com/product/0008',
'imageUrl' => 'http://site.com/product/0008.jpg',
));
$cart = new Cart(
array(
'id' => 'test-cart-0008',
'totalATI' => 200,
'totalET' => 150,
'accountId' => '3847569834',
'firstname' => 'Tester',
'email' => '[email protected] ',
'country' => 'United States',
'countryCode' => 'USA',
)
);
$cart->addItem($item);
$status = $cartsGuru->trackCart($cart);
$order = new Order(
array(
'id' => 'test-order-0008',
'cartId' => 'test-cart-0008',
'totalATI' => 200,
'totalET' => 150,
'state' => 'approved',
'accountId' => '3847569834',
'firstname' => 'Tester',
'email' => '[email protected] ',
'country' => 'United States',
'countryCode' => 'USA',
)
);
$order->addItem($item);
$status = $cartsGuru->trackOrder($order);