Correct YML for Yandex.Market. Programmer's Look


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

    Checking such a price list for errors and eliminating those is the whole story. Until it is formed according to all the rules, the entrance to this kingdom of dumping is ordered. And when you bring the document to mind, you can experience many unforgettable emotions.

    This article is an attempt to summarize the errors experienced by programmers who first create tools (whether it be a stand-alone script or a plugin for CMS) to generate a YML file. For those who have dealt with this wonderful format before, the article will not be so interesting, because all the bumps are full. However, suddenly, veterans of the struggle for their place under the Yandex sun will learn something new for themselves. And then they will share their own front-line experience.

    Error classification


    1. Irrelevant errors


      • Wrong coding. The first thing that stumbled in the good old days. Most of the engines run on UTF-8, and NM once required only your favorite Windows encoding. Rumor has it that capricious Yasha could be fooled - pretending to agree to the godless cp1251 when approving the store, after "customs gives the go-ahead" - it is safe to replace the price with racially loyal Unicode. What is interesting - CSV (as an undesirable 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, it must comply with its basic rules. Do not forget about mandatory availability and, we follow the correct nesting of tags, we replace the "magnificent five" ( " , & , < , > , ' ) with their mnemonic equivalents.

      Moreover, in the mnemonics themselves, the & symbol does not need to be changed to its mnemonics & , otherwise it takes some kind of infinite recursion it can turn out before applying to the text (for the element, for example) the htmlspecialchars function , it should be noted that there may already be mnemonics 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 re-read 3 times (and even better - 5) carefully the official documentation, do not forget about global tags (, ), we follow the correct spelling of the names, we do not deal with the gag in the form of inventing tags that do not exist in the specification, we arrange the entire hierarchy according to yml-Feng Shui, specify the parameters correctly, etc.


      • Lack of required elements. The most common mistakes of beginners and not so beginners. Especially often this pops up when creating offers . An optional tag for one kind of description may be required for another. For example,. You can run into this if you used a simplified description before the product , and then you suddenly decided to redo it to vendor.model .

      • Not a canonical order of elements. A very vile mistake, just a blow under the breath for those who encounter it for the first time. The situation when Yandex calmly insists that such-and-such a position in a line is something and that is wrong , and nothing suspicious is visible at the indicated place (moreover, google forums and meditation on off-documenting does not give any effect) - can bring any to white heat.
        And the casket just opens - the elements should go exactly in the order in which they are listed in the specification. Here in a simplified description, first the name of the product, and then the manufacturer. And in vendor.model, first the manufacturer, and then the name of the product. And by no means the other way around.

      • Repetitions of products by ID. What touches, this error is immediately generated by Yandex in two different ways (so that no one gets confused) - first, elements with incorrect identifiers are listed, and then there is a list of duplicate offers.
        With a fright, you can decide that there are 2 times more errors than actually. And if everything is clear with duplicates, then the uninitiated still have to guess what exactly incorrect identifiers are incorrect.

    4. Non Critical YML Errors



      Yandex is almost pleased. We’ll work a little more.

      • Invalid URLs. Often these are links, for example, containing white space characters or Russian letters. In general, many engines in database tables usually have fields storing direct links to product pages. Typically, in almost all CMS among these links there is a lot of garbage and therefore usually you 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 about the goods where they forgot to indicate the cost, they will remember soon. Or not filter it and let the content manager deal with Yandex claims in the future.

      • Invalid image links. Well, the story is about the same as with the wrong URLs. The images registered in the database often do not exist in nature. Before you issue another- check for the presence of a file. If the picture is available, but there are unfortunate spaces in the title, encode the 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 does not spit out. Wait a moment to relax, in a couple of days a “letter of happiness” from the NM managers may well come in, which notifies that:

      • The product line is slagged from another store. A particularly serious crime punishable by the severity of the law.
      • In your price list we persistently searched and found duplicates!
      • And by the way, some links lead to the wrong place.
      • What idiot created this categorization?
      • As a photo of the product, plugs are used.
      • The same photos from different products. So what about the fact that the official site of the manufacturer is the same?
      • And some pictures are not from your site at all.
      • In the muddy waters of the elements floating "fish".
      • The store has 100% prepayment, but why not gu-gu in the body of an optional element?
      • Ah, do you have only one out of 500 products from the order? Why is it aviable = 'true' and not 'false'?
      • You, dear, delivery is 3 days, and according to our concepts, the goods are considered "affordable" if delivered within 2.
      • ... and so on.

      Therefore, your shop has been removed from the presence in the trading universe of Yandex.Market for a period of a week to forever.

      By and large, such errors are outside the competence of coders. Other specially trained people are responsible for them - content managers, SEO experts, marketers, or who else were burdened there to monitor the contents of the site. However, programmers can sometimes help here. For example, filtering stub images (identifying 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 errors


    It’s easiest to catch all these numerous bloopers in this order.

    • XML errors. Note to the host - duplicate yml files with the xml extension, at least during the testing period (and it can come in handy later). In browsers and text editors, yml documents open as dull textbooks, which makes them inconvenient for viewing and analysis. In the wilds of XML, it’s much easier to navigate: there is always a cheerful tag highlighting + elements can be “collapsed” in accordance with their hierarchical structure + the browser will helpfully tell you where the specification mismatches. In general, tracking YML errors is easier by opening it as XML.

    • Check in Yandex Market. Well, the last word belongs to Yandex. After registering the store, check the file in their validator and eliminate the generated errors until the end.


    References


    Yandex:

    Official YML specification
    Requirements for the data transfer method
    Validator
    Questions and answers
    Requirements for advertising 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

    Only registered users can participate in the survey. Please come in.

    Have you ever written scripts / plugins to generate YML from scratch?

    • 34.2% Yes, there were never any special difficulties 49
    • 23.7% Yes, when I tuned for the first time, I cursed everything in the world 34
    • 41.9% No, it was not necessary 60

    Also popular now: