📜 ⬆️ ⬇️

Correct YML for Yandex.Market. Programmer's Look


Many online stores fall into Yandex.Market, not all stay there for long. One of the conditions of presence in the NM-e - the presence of the correct price in a special format YML.

Checking this price for errors and the elimination of those - the whole story. Until it is formed by all the rules - the entrance to this realm of dumping is ordered. And when you bring the document to the mind, you can experience a lot of unforgettable emotions.

This article is an attempt to summarize the mistakes that programmers encounter for the first time creating tools (be it a stand-alone script or a plugin for CMS) for generating a YML file. Those who dealt with this wonderful format before, the article will not be so interesting, because all the bumps are full. However, all of a sudden and veterans of the struggle for their place under the sun of Yandex will learn something new for themselves. And then they will share their own front-line experience.

Error classification


  1. Irrelevant errors


    • Wrong encoding. The first thing that stumbled in the good old days. Most engines work on UTF-8, while NM once required only the Windows favorite encoding. Rumor has it that the capricious Yashu could have been fired up - to pretend that they agree to the godless cp1251 when approving a store, after “customs give the go-ahead” - quietly replace the price with racially faithful Unicode. What is interesting - CSV (as an unwanted alternative to YML) Yandex.Market accepts exclusively in UTF-8 :)

    All other rakes are still there.
    ')
  2. XML specification errors



    YML is a special case of XML. So, must comply with its basic rules. We do not forget about the obligatory presence of <? Xml?> And <! DOCTYPE> , we monitor the correct nesting of tags, we replace the "magnificent five" ( " , & , < , > , ' ) with their mnemonic equivalents.

    Moreover, in the mnemonics themselves, the & symbol on its mnemonic & amp; no need to change, and then some kind of infinite recursion can happen. Before applying the htmlspecialchars function to the text (for the <description> element, for example), it should be noted that mnemonics may already be present there;)

  3. Critical YML Errors


    Now your price is kosher XML, but Yandex flatly refuses to accept it. We understand further.

    • Errors in the use of elements. We reread 3 times (and even better - 5) attentively official documentation, do not forget about global tags (<yml_catalog>, <shop>), monitor the correct spelling of names, do not deal with gag in the form of inventing nonexistent tags in the specification, we arrange the entire hierarchy by yml-sko feng shui, we specify the parameters, etc.


    • Lack of required items. The most frequent mistakes of beginners and not so beginners. Especially often this pops up when forming an offer . An optional tag for one kind of description may be required for another. For example, <vendor>. You can run into this if earlier a simplified description was applied to the product, and then suddenly decided to remake it on vendor.model .

    • Not canonical element order. Very mean mistake, downright blow in the gut for those who are facing it for the first time. The situation where Yandex calmly insists that such a position in the line is something wrong , and there is nothing suspicious in the specified place and it is not visible at all (and, googling forums and meditating on documenting the effect does not) any white heat.
      A casket just opens - the elements should go exactly in the order in which they are listed in the specification. Here in the simplified description, first the name of the product, and then the manufacturer. And in vendor.model first manufacturer, and then the name of the product. And by no means the opposite.

    • Repeat products by ID. What touches, this error is given out by Yandex in two different ways at once (so that no one is confused) - first, elements with incorrect identifiers are listed, and then the list of duplicate offers goes.
      With a fright one can decide that there are 2 times more mistakes than in reality. And if everything is clear with duplicates, the uninitiated still have to guess what the incorrect identifiers are incorrect.

  4. Nonfatal YML Errors



    Yandex is almost gratified. Work a little more.

    • Invalid URLs. Often these are links, for example, containing whitespace characters or Russian letters. In general, many engines in the database tables usually have fields that store direct links to product pages. What is characteristic, in almost all CMS among these links is a lot of garbage and therefore usually have to generate it yourself.

    • The price is 0. Here, the programmer needs to consult with the content manager. Or filter zero prices, but then the goods, where they forgot to specify the cost, will not be remembered soon. Or do not filter and let the content manager in the future with the claims of Yandex himself understand.

    • Invalid links to pictures. Well, it's about the same story as the wrong URL. Images registered in the database often do not exist in nature. Before you make another <picture> - check the file. If the picture is available, but there are unfortunate spaces in the title - encode links in RFC3986 (the rawurlencode function will help you).


  5. Other errors


    OK, all the flaws are totally eliminated and the yml-price fed to Yandex is not spat back. Wait a moment to relax, in a couple of days a “letter of happiness” may come from the NM managers, who are notified that:

    • Product line is glossy from another store. Particularly serious crime punishable to the fullest extent of the law.
    • In your price list, we persistently searched and found duplicates!
    • And by the way, some links are not there.
    • What idiot created this categorization?
    • As a photo of products are used plugs.
    • Same photos of different products. Well, so what with the fact that on the official website of the manufacturer is the same?
    • And some pictures are not from your site at all.
    • In the murky waters of the elements <description> swims "fish."
    • The store has a 100% prepayment, but why not a gug in the body of the optional <sales_notes> element?
    • Ah, do you have only one “under the order” out of 500 products? And why does he have aviable = 'true', and not 'false'?
    • You have, dear, delivery for 3 days, and according to our concepts, the product is considered “affordable” if delivered within 2 days.
    • ... and so on.

    And therefore, your shop is still suspended from being present in the Yandex.Market trade universe for a week to forever.

    By and large, such errors are beyond the competence of coders. They are responsible for other specially trained people - content managers, SEO-Schnick, marketers, or anyone else there have loaded to monitor the content of the site. However, programmers can sometimes help here. For example, filtering image stubs (by defining them by standard names) or not missing product descriptions, for some reason beginning with the words “ Lorem ipsum ” and “ bla bla bla ”.


How and where to check for errors


It is easiest to catch all these numerous lapses in this order.


Links


Yandex:

Official YML specification
Requirements for data transfer method
Validator
Questions and answers
Requirements for promotional materials

Habrahabr:

Yandex.Market - to be or not?
Placement of goods on Yandex.Market. Typical problems and their solutions
Night grunts about Yandex, Market and interfaces in general

Poll

Source: https://habr.com/ru/post/216985/


All Articles