sfYandexYMLPlugin - 0.1.2

Yandex YML generator

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfYandexYML plugin

Some classes helping to create XML files for the Yandex.Market service. Description of the YML language http://partner.market.yandex.ru/legal/tt/.

Installation

  • Install the plugin

    $ symfony plugin:install sfYandexYMLPlugin
    
  • Clear cache

    $ symfony cc
    

Usage

// creating a YML document
$yml = new sfYandexYML(
    'My eShop',
    'OOO Roga&Kopita',
    'http://my-shop.com');
 
// creating categories
$cat1 = new sfYandexYMLCategory(1, 'T-shirts');
$cat2 = new sfYandexYMLCategory(2, 'Drinks');
$cat2 = new sfYandexYMLCategory(3, 'Vodka', 2); // child of Drinks
 
// adding categories to document
$yml->addCategory($cat1);
$yml->addCategory($cat2);
$yml->addCategory($cat3);
 
// creating a simple offer
$offer = new sfYandexYMLOffer_Model(1, true); // simple offer
$offer->country_of_origin = 'Russia';
$offer->currencyId = 'RUR';
$offer->categoryId = $cat3->getId();
$offer->delivery = true;
$offer->description = $product->getShortDescription();
$offer->downloadable=false;
$offer->local_delivery_cost = 200;
$offer->name = "Stolichnaya 0.5l";
$offer->picture = 'http://my-shop.com/pix/stolichnaya.jpg';
$offer->price = '329.99';
$offer->sales_notes = 'Design bottle';
$offer->url = 'http://my-shop.com/shop/drinks/stolichnaya05l.html';
$offer->vendor = 'OAO Kristall';
$offer->vendorCode = '12712-80';
 
// adding the offer to document
$yml->addOffer($offer);
 
$yml->generateYML(); // generate document
$yml_as_string =  $yml->saveYML(); // get YML as string