PHP code example of gigabit / affilinet-php-sdk
1. Go to this page and download the library: Download gigabit/affilinet-php-sdk 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/ */
gigabit / affilinet-php-sdk example snippets
$config = [
'publisher_id' => {PUBLISHER ID},
'product_webservice_password' => {PRODUCT WEBSERVICE PASSWORD}
]
$affilinet = new \Affilinet\ProductData\AffilinetClient($config);
// simple search for t-shirts (using the product webservice)
try {
$search = new \Affilinet\ProductData\Requests\ProductsRequest($affilinet);
$query = new \Affilinet\ProductData\Requests\Helper\Query();
$query->where($query->expr()->exactly('T-Shirt'));
$search
->query( $query)
->onlyWithImage()
->minPrice(1)
->maxPrice(100)
->page(1)
->pageSize(20);
$response = $search->send();
}
catch (\Affilinet\ProductData\Exceptions\AffilinetProductWebserviceException $e) {
// There is an error within your $search
echo 'Error: ' . $e->getMessage();
}
echo 'Total results : ' . $response->totalRecords() ;
foreach ($response->getProducts() as $product) {
echo $product->getProductName();
echo $product->getPriceInformation()->getDisplayPrice();
}