Skip to content

Instantly share code, notes, and snippets.

@4e6ka
Last active July 21, 2018 20:10
Show Gist options
  • Save 4e6ka/6f9d7d656bac1342ae1de605d8bbb46d to your computer and use it in GitHub Desktop.
Save 4e6ka/6f9d7d656bac1342ae1de605d8bbb46d to your computer and use it in GitHub Desktop.
YML выгрузка для "товары и цены", делаем хорошие сниппеты у Яндекса
Создаём документ xml
Содержание:
<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="[[!time2]]" >
<shop>
<name>Название магазина</name>
<company>Название компании</company>
<url>https://site.ru</url>
<currencies>
<currency id="RUR" rate="1"/>
</currencies>
<categories>
[[!pdoResources?
&parents=`2`
&templates=`6`
&parents=`21`
&depth=`4`
&limit=`1000`
&tpl=`YML_categories`
&context=`web`
]]
</categories>
<offers>
[[!msProducts?
&parents=`2`
&limit=`10000`
&resources=`-45385`
&includeTVs=`image`
&tpl=`YML_offer`
&includeThumbs=`360x270`
]]
</offers>
</shop>
</yml_catalog>
Содержания чанков:
YML_categories
<category id="[[+id]]" [[+parent:is=`2`:then=``:else=`parentId="[[+parent]]"`]]>[[+pagetitle:deleteLetter]]</category>
YML_offer
<offer id="[[+id]]" available="true">
<url>[[++site_url]][[~[[+id]]]]</url>
<price>[[+price_currency:strip]]</price>
<currencyId>RUR</currencyId>
<categoryId>[[+parent]]</categoryId>
<picture>https://sitep.ru/[[+360x270:default=`/assets/components/minishop2/img/web/ms2_big.png`]]</picture>
<delivery>true</delivery>
<name>[[+pagetitle:deleteLetter]]</name>
<model>[[+article]]</model>
<description>[[+longtitle:deleteLetter]]</description>
</offer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment