Product Export from Website to YML Feed

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Product Export from Website to YML Feed
Medium
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Implementing product export to YML feed

YML (Yandex Market Language) is an XML format that Yandex.Market requires for catalog upload. Properly formed feed ensures error-free indexing, correct offer display and admission to paid placements. Incorrect feed means rejected products, shop penalty points and loss of search visibility.

YML structure and Yandex.Market requirements

Format described in official documentation. Minimal structure:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE yml_catalog SYSTEM "shops.dtd">
<yml_catalog date="2024-01-15 10:00">
  <shop>
    <name>My store</name>
    <company>LLC Company</company>
    <url>https://example.com</url>
    <currencies>
      <currency id="RUR" rate="1"/>
    </currencies>
    <categories>
      <category id="10">Electronics</category>
      <category id="11" parentId="10">Smartphones</category>
    </categories>
    <offers>
      <offer id="12345" available="true">
        <url>https://example.com/product/12345</url>
        <price>29990</price>
        <currencyId>RUR</currencyId>
        <categoryId>11</categoryId>
        <picture>https://example.com/img/12345.jpg</picture>
        <name>Samsung Galaxy S24 Smartphone</name>
        <vendor>Samsung</vendor>
        <description>...</description>
        <param name="Color">Black</param>
        <param name="Memory">256 GB</param>
      </offer>
    </offers>
  </shop>
</yml_catalog>

Critical fields for admission: url, price, currencyId, categoryId, name. Field available affects display — products with false excluded from search but preserved in price history.

Feed generator architecture

For small catalogs (up to 10,000 products) feed can be generated on-the-fly. For larger — only via background task with disk or CDN storage.

Workflow:

Cron/Queue → Builder → XML Writer → Storage (disk/S3) → Public URL

PHP implementation (Laravel):

class YmlFeedBuilder
{
    public function build(string $outputPath): void
    {
        $writer = new XMLWriter();
        $writer->openUri($outputPath);
        $writer->startDocument('1.0', 'UTF-8');
        $writer->writeDtd('yml_catalog', null, 'shops.dtd');

        $writer->startElement('yml_catalog');
        $writer->writeAttribute('date', now()->format('Y-m-d H:i'));

        $this->writeShopInfo($writer);
        $this->writeCurrencies($writer);
        $this->writeCategories($writer);
        $this->writeOffers($writer);

        $writer->endElement();
        $writer->endDocument();
        $writer->flush();
    }

    private function writeOffers(XMLWriter $writer): void
    {
        $writer->startElement('offers');

        Product::with(['category', 'attributes', 'images'])
            ->where('active', true)
            ->where('price', '>', 0)
            ->chunk(500, function ($products) use ($writer) {
                foreach ($products as $product) {
                    $this->writeOffer($writer, $product);
                }
            });

        $writer->endElement();
    }
}

Using chunk() is mandatory — attempting to load 50,000+ products in one query guarantees OOM.

Offer types

Yandex.Market distinguishes several types, each with required fields:

Type Application Required additional fields
vendor.model Electronics, equipment vendor, model
book Books author, isbn
audiobook Audiobooks author, publisher
medicine Medicines vendor, registration-number
artist.title Music, film artist, title
tour Tours worldRegion, country
Default Everything else

For most online stores vendor.model or default type works.

Feed validation

Before sending to Yandex.Market, feed must be validated locally. Use Feed Validator or shops.dtd schema.

Custom validation during build:

class YmlFeedValidator
{
    public function validate(string $filePath): array
    {
        $errors = [];
        $dom = new DOMDocument();

        if (!$dom->load($filePath)) {
            return ['XML parse error'];
        }

        $offers = $dom->getElementsByTagName('offer');
        foreach ($offers as $offer) {
            $id = $offer->getAttribute('id');

            if (!$offer->getElementsByTagName('price')->length) {
                $errors[] = "Offer {$id}: missing price";
            }
            if (!$offer->getElementsByTagName('url')->length) {
                $errors[] = "Offer {$id}: missing url";
            }
            // Check description length (Yandex truncates after 3000 chars)
            $desc = $offer->getElementsByTagName('description')->item(0);
            if ($desc && mb_strlen($desc->textContent) > 3000) {
                $errors[] = "Offer {$id}: description too long";
            }
        }

        return $errors;
    }
}

Update schedule

Frequency depends on catalog dynamics:

  • Prices and stock — change frequently: regenerate every 1–4 hours recommended
  • Attributes and descriptions — change slowly: sufficient once daily
  • New products — immediately or at next hourly cycle

Example schedule in Laravel (app/Console/Kernel.php):

$schedule->job(new GenerateYmlFeedJob)->everyFourHours();

Feed size optimization

Yandex.Market recommends not exceeding 500 MB per feed. If larger — split by category and register multiple feeds in cabinet.

Reduce size without quality loss:

  • Exclude products without price (WHERE price > 0)
  • Exclude inactive categories
  • Truncate description to 1000–1500 chars
  • Compress feed with gzip (Content-Encoding: gzip) — Yandex supports
// Compress ready feed
$source = storage_path('app/public/feed.xml');
$compressed = storage_path('app/public/feed.xml.gz');

$fp = gzopen($compressed, 'w9');
gzwrite($fp, file_get_contents($source));
gzclose($fp);

Timeline

  • Basic generator with default type: 1–2 days
  • Add typed offers (vendor.model): +0.5 day
  • Validator + error logging: +0.5 day
  • Cron setup + public URL: +0.5 day

Total typical project: 2–3 working days.