-
Notifications
You must be signed in to change notification settings - Fork 15
/
event.php
116 lines (79 loc) · 8.91 KB
/
event.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include('../src/ymlOffer.php');
include("../src/ymlDocument.php");
use notdest\yandexYmlGenerator\ymlDocument ;
$fileName = './event.xml' ;
//параметры: Короткое название магазина, полное наименование компании, [кодировка, по умолчанию utf-8]
$y = new ymlDocument('Магаз','ООО Шикарный магаз интернейшнл'/* , 'windows-1251'*/);
$y ->fileName($fileName) // имя файла, если хотим не по умолчанию './out.xml'
->bufferSize(1024*1024*16); // если не нравится размер файлового буффера в php по умолчанию,байт
$y ->url('http://best.seller.ru'); // !!! условно обязательный. Адрес магазина
$y ->cms('Joomla!','3.4') // CMS: название, [версия] они же 'platform' и 'version'
->agency('Webdivision.ru') // Агенство, отвечающее за работоспособность сайта
->email('[email protected]'); // Контактный адрес разработчиков CMS или агентства
$y ->currency('RUR',1) // !!! Минимум одна. Добавляем валюты, это основная, тк rate=1
->currency('USD','CBRF',3) // считаем по курсу ЦБ РФ, плюс 3 %
->currency('EUR',70.8) // дробную часть отделяем точкой
->category(1,'Книги') // !!! должны быть. категория, находится в корне, id - положительное целое число, больше 0
->category(2,'Детективы',1) // подкатегория в "книги"
->category(3,'Боевики',1)
->category(4,'Видео')
->category(5,'Комедии',4);
$y ->delivery(300,4,18) // !!! Условно обязательно. Доставка: стоимость 300р, срок 4 дня , до 18:00 срок не изменится
->delivery(500,0,15)
->delivery(0,'7-8')
->cpa(); // включение программы "Заказ на Маркете", можно еще передать false
//-------------- добавляем одно описание для мероприятия -----------------------------
// name,place,date, id, price, currencyId, categoryId , [price from - "цена от ххх руб." ]
$offer = $y->event('Дмитрий Хворостовский и остальные','Московский Дом музыки','2012-02-25 12:03:14', 'id01id1111', 900, "USD", 15 /* , true*/);
$offer ->hall('Большой зал') // Зал.
->hallPart('Партер р. 1-5') // Ряд и место в зале.
->premiere(0) // Признак премьерности мероприятия.
->kids('true') // Признак детского мероприятия.
// У этих 2х полей непонятно - true/false или 1/0. В описании одно в примере другое
->cbid(80) // Размер ставки на карточке товара. 0,8 у.е.
->bid(90) // Размер ставки на остальных местах размещения. 0,9 у.е.
->fee(220) // Размер комиссии от цены товара. 2.2%
->available(false) // под заказ
->url("http://magaz.ru/tovar.html") // !!! условно обязательный. URL страницы товара
->oldprice(1500) // Старая цена для расчёта скидки
//->vat('VAT_10_110') отсутствует в схеме // Ставка НДС для товара.
->pic('http://best.seller.ru/img/device12345.jpg') // !!! условно обязательные. Картинки
->pic('http://best.seller.ru/img/device124.jpg')
->pic('http://best.seller.ru/img/devi45.jpg')
->delivery(/* false*/ ) // Возможно доставить. false, чтобы невозможно
->dlvOption(300,4,18) // Доставка: стоимость 300р, срок 4 дня , до 18:00 срок не изменится
->dlvOption(0,'7-8') // бесплатно довезем через неделю. Вообще не больше 5 опций
->pickup() // Возможен самовывоз
->store() // можно купить в розничном магазине
->description( // Описание с разрешенными тегами
'<h3>Концерт Дмитрия Хворостовского ...</h3>
<p>тут подробнее</p>'
,true)
// ->description('Просто описание') // или просто описание
->sale('первым десяти покупателям скидка 15%') // !!! sales_notes, минимальные суммы и партии, наличие скидок и т.д.
//->minq(2) отсутствует в схеме // ~ только в некоторых категориях. min-quantity ,минимальный заказ 2шт.
//->stepq(2) отсутствует в схеме // ~ только в некоторых категориях. step-quantity , заказывыем по 2шт.
->warranty() // manufacturer_warranty Официальная гарантия производителя.
->origin('Демократическая Республика Конго') // country_of_origin. страна производитель из списка Яндекса. Иногда желательно указывать
->adult() // является товаром "для взрослых"
->barcode(11122299) // штрихкод указанный производителем
->cpa(false) // нельзя сделать "Заказ на Маркете"
->param('Размер экрана','27','дюйм') // Параметры из поиска на маркете
->param('Материал','алюминий')
->expiry('P1Y2M10DT2H30M') // Срок годности ISO8601, может иметь формат YYYY-MM-DDThh:mm
->weight(15.1) // Вес товара в килограммах с учетом упаковки.
->dimensions(14.0,80.2,90.0) // длина, ширина и высота в сантиметрах
->downloadable() // товар можно скачать
->age(5,'month') // возрастная категория, годы или месяцы
//->age(16,'year')
;
unset($y); // надо чтобы запустился деструктор
echo "Создан файл $fileName <br>\n";
$checker = new DOMDocument('1.0',"UTF-8");
$checker->load($fileName);
$valid = $checker->schemaValidate('./shops_with_byn.xsd');
echo ($valid) ? "Файл сответствует схеме" : "Файл не сответствует схеме";
?>