PHP code example of retargeting / retargeting-sdk
1. Go to this page and download the library: Download retargeting/retargeting-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/ */
retargeting / retargeting-sdk example snippets
use Retargeting/Product;
$brand = [
'id' => 8,
'name' => 'Apple'
];
$category = [
[
"id" => 20,
"name" => "Desktop",
"parent" => false,
"breadcrumb" => []
],
[
"id" => 28,
"name" => "Monitors",
"parent" => 25,
"breadcrumb" => [
["id" => 25, "name" => "Components", "parent" => false]
]
];
$inventory = [
'variations' => true,
'stock' => [
'Red' => true,
'Small' => false,
'Medium' => true,
]
];
$additionalImages = [
"http://localhost/upload/image/catalog/demo/canon_logo.jpg",
"http://localhost/upload/image/catalog/demo/hp_1.jpg",
"http://localhost/upload/image/catalog/demo/compaq_presario.jpg",
"http://localhost/upload/image/catalog/demo/canon_eos_5d_1.jpg",
"http://localhost/upload/image/catalog/demo/canon_eos_5d_2.jpg"
];
$product = new Product();
$product->setId(42);
$product->setName('Shoes');
$product->setUrl('http://localhost/upload/test');
$product->setImg('http://localhost/upload/image/catalog/demo/apple_cinema_30.jpg');
$product->setPrice(122);
$product->setPromo(90);
$product->setBrand($brand);
$product->setCategory($category);
$product->setInventory($inventory);
$product->setAdditionalImages($additionalImages)
echo $product->getData();