2017 © Pedro Peláez
 

library feed

Nette extension for export xml feeds

image

makr/feed

Nette extension for export xml feeds

  • Thursday, December 21, 2017
  • by martinknor
  • Repository
  • 3 Watchers
  • 5 Stars
  • 253 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 3 Open issues
  • 12 Versions
  • 3 % Grown

The README.md

Feed

Library for create xml feeds - Heureka - Zbozi, (*1)

in Nette, (*2)

Installation

The best way to install Mk/Feed is using Composer:, (*3)

$ composer require makr/feed

Configuration

.neon, (*4)

extensions:
    feed: Mk\Feed\DI\FeedExtension

feed:
    exportsDir: '%wwwDir%'
    exports   : 
        heureka: \App\Models\HeurekaGenerator
        zbozi  : \App\Models\ZboziGenerator

Config

For run is used Kdyby/Console Read how to setup Kdyby/Console, (*5)

php index.php

After successful installation display:, (*6)

Available commands:
Feed:export     Export products

Usage

For each feed (heureka, zbozi) you must create one factory (IGenerator), (*7)

<?php

namespace App\Model;

use Mk\Feed\Generators\Zbozi\ExtraMessage;
use Mk\Feed\Generators\Zbozi\Generator;
use Mk\Feed\Generators\Zbozi\Item;

class ZboziGenerator extends Generator {
    function generate()
    {

        $items = [
            $this->createItem(),
            $this->createItem(),
            $this->createItem(),
            $this->createItem(),
        ];

        foreach ($items as $item) {
            $this->addItem($item);
        }
    }

    protected function createItem()
    {
        $item = new Item();
        $item->setProductName('Name')   #název nabídky, povinné, doporučená délka 70 znaků
            ->setDescription('Description') #popis nabídky, povinné (doporučená délka do 1000 znaků)
            ->setUrl('http://www.seznam.cz') #adresa nabídky v eshopu, povinné
            ->setPriceVat(10) #cena, povinné; číselná hodnota, max. dvě desetinná místa
            ->setDeliveryDate(0) #dostupnost, povinné (celé číslo nebo datum ve formátu RRRR-MM-DD)
            ->setItemId(123) #identifikátor nabídky v eshopu, nepovinné (alfanumerické znaky)
            ->setEan(87458965) #kód obchodní položky (čárový kód), nepovinné
            ->setIsbn('978-1-78038-067-4') #identifikační číslo knihy, nepovinné
            ->setProductNo('PRO1548') #produktový kód výrobce, nepovinné
            ->setItemGroupId(10) #označení skupiny nabídek, nepovinné
            ->setManufacturer('Adidas') #výrobce produktu, nepovinné
            ->setBrand('Nike') #značka produktu, nepovinné
            ->setCategoryId(1) #ID kategorie Zboží.cz, nepovinné
            ->setProduct('Cerny') #název nabídky ve výsledcích vyhledávání, např. "+ dárek zdarma", nepovinné
            ->setVisibility(true) #zobrazování nabídky na Zboží.cz
            ->setCustomLabel('neco') #dodatečné označení nabídky, vytvoří skupinu - kolekce, sezoni akce
            ->setCustomLabel1('nic') #dodatečné označení nabídky, vytvoří skupinu - kolekce, sezoni akce
            ->setMaxCpc(10) #maximální cena za proklik
            ->setMaxCpcSearch(10.2) #maximální cena za proklik pro nezařazené nabídky
            ->setProductLine('iPod | iPod Touch') #produktová řada
            ->setListPrice(999) #doporučená koncová prodejní cena
            ->setReleaseDate(new \DateTime()); #datum oficiálního zahájení prodeje v ČR

        #category text
         $item->addCategoryText('Kategorie | Subkategorie');
         $item->addCategoryText('Kategorie | Subkategorie1');

        #images
         $item->addImage('http://placehold.it/350x150'); #adresa obrázku, nepovinné, doporučujeme uvádět; značku je možné opakovat
         $item->addImage('http://placehold.it/350x150');
         $item->addImage('http://placehold.it/350x150');

        #extra messages
         $item->addExtraMessage(ExtraMessage::EXTENDED_WARRANTY); #doplňkové informace o nabídce, @see http://napoveda.seznam.cz/cz/zbozi/specifikace-xml-pro-obchody/specifikace-xml-feedu/#EXTRA_MESSAGE
         $item->addExtraMessage(ExtraMessage::FREE_DELIVERY);

        #shops
         $item->addShopDepot(1234); #výdejní místo pro okamžitý odběr
         $item->addShopDepot(5678);

        #parameters
         $item->addParameter('Barva', 'Hnědá'); #parametry nabídky
         $item->addParameter('Váha', '10', 'Kg');

        return $item;
    }

}

Categories helper

For getting available categories you can call CategoryHelper, (*8)


$categories = new \Mk\Feed\Generators\Zbozi\CategoriesHelper(); #first parameter can be cache storage for caching results dump($categories->getCategories());
$ php index.php Feed:export -s

Execute config

$ php index.php Feed:export

Inspired by Trejjam/Export, (*9)

The Versions

21/12 2017

dev-master

9999999-dev

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

merchant nette heureka zbozi

21/12 2017

1.1.0

1.1.0.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

merchant nette heureka zbozi

25/11 2017

1.0.9

1.0.9.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

07/12 2016

1.0.8

1.0.8.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

29/04 2016

1.0.7

1.0.7.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

11/04 2016

1.0.6

1.0.6.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

24/03 2016

1.0.5

1.0.5.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

23/03 2016

1.0.4

1.0.4.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

20/03 2016

1.0.3

1.0.3.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

19/03 2016

1.0.2

1.0.2.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

19/03 2016

1.0.0

1.0.0.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi

19/03 2016

1.0.1

1.0.1.0

Nette extension for export xml feeds

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Knor

nette heureka zbozi