PHP code example of trejjam / export
1. Go to this page and download the library: Download trejjam/export 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/ */
trejjam / export example snippets
use Nette,
Trejjam;
class Products implements Trejjam\Export\IProducts {
/**
* {@inheritdoc}
*/
public function getItems(Trejjam\Export\StoreItems $storage, $shop, Symfony\Component\Console\Command\Command $command, Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output) {
foreach ($this->getProducts() as $v) {
if ($shop=='heureka') {
$item = new Trejjam\Export\Heureka\Item;
$item->id = $v->id;
$item->name = $v->name;
$item->longName = $v->description;
$item->description = $v->description2;
$item->url = $presenter->link('//:presenter:action', ['productId' => $v->id,]);
$item->img;
$imgAlternative = new Trejjam\Export\Heureka\AlternativeImg;
$imgAlternative->img;
$item->imgAlternative[] = $imgAlternative;
$item->video;
$item->price;
$item->type;
$item->cpc;
$item->manufacturer;
$item->category;
$item->ean = $v->EAN;
$item->isbn;
$item->no = $v->code;
$param = new Trejjam\Export\Heureka\Params;
$param->name;
$param->value;
$item->params = [];
$item->deliveryDate;
$delivery = new Trejjam\Export\Heureka\Delivery;
$delivery->name;
$delivery->price;
$delivery->priceCod;
$item->delivery[] = $delivery;
$item->groupId;
$item->accessory;
$storage->addItem($item);
}
else if ($shop=='zbozi') {
$item = new Trejjam\Export\Zbozi\Item;
$item->product;
$item->name;
$item->nameExt;
$item->description;
$item->url;
$item->img;
$item->price;
$item->vat;
$item->priceVat;
$item->cpc;
$item->cpcSearch;
$item->dues;
$item->deliveryDate;
$item->shopDepots;
$item->unfeatured;
$item->type;
$item->extraMessage;
$item->manufacturer;
$item->category;
$item->no;
$variant=new Trejjam\Export\Zbozi\Variant;
$variant->nameExt; //rewrite Item::properties
$item->variants[]=$variant;
$storage->addItem($item);
}
}
}
}
sh
php index.php
sh
$ php index.php Cron:export -p
sh
$ php index.php Cron:export -e heureka -e zbozi