trejjam/export

Export products for Heureka and Zbozi

v0.3 2015-08-06 16:42 UTC

This package is auto-updated.

Last update: 2024-03-05 17:45:22 UTC


README

Library for export products to

in Nette

Installation

The best way to install Trejjam/Export is using Composer:

$ composer require trejjam/export

Configuration

.neon

extensions:
	export: Trejjam\Export\DI\ExportExtension

export:
	exportsDir: '%wwwDir%'
    exports   : 
        heureka: yes
        zbozi  : yes

Config

For run is used Kdyby/Console Read how to setup Kdyby/Console

php index.php

After successful installation display:

Available commands:
Cron:export     Export products
	

Usage

Products:

services:
	- Products
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);
			}
        }
    }
}

Print available config

$ php index.php Cron:export -p

Execute config

$ php index.php Cron:export -e heureka -e zbozi