Product Import from 1C (CommerceML/XML)

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.

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 Import from 1C (CommerceML/XML)

Data exchange between 1C and website is one of the most in-demand and technically ambiguous tasks in web development. CommerceML standard exists since 2000s, but each 1C configuration implements it differently: XML structure, field population, category export logic, attributes vary. No universal solution exists — integration needed for specific configuration.

CommerceML Standard

1C exports data in ZIP archives with XML files:

import.zip
├── import.xml      — product catalog, categories, properties
├── offers.xml      — warehouses, prices, stock
└── import0.xml     — catalog continuation (when split into files)

Structure example:

<?xml version="1.0" encoding="UTF-8"?>
<КоммерческаяИнформация ВерсияСхемы="2.10">
  <Каталог>
    <Группы>
      <Группа>
        <Ид>f47ac10b-58cc-4372-a567-0e02b2c3d479</Ид>
        <Наименование>Электроника</Наименование>
      </Группа>
    </Группы>
    <Товары>
      <Товар>
        <Ид>550e8400-e29b-41d4-a716-446655440000</Ид>
        <Артикул>IPH-15-PRO-256</Артикул>
        <Наименование>iPhone 15 Pro 256GB</Наименование>
      </Товар>
    </Товары>
  </Каталог>
</КоммерческаяИнформация>

Exchange Protocol

1C initiates exchange via HTTP requests to site. Site implements handler on specific URLs:

GET  /1c-exchange/?type=catalog&mode=checkauth
GET  /1c-exchange/?type=catalog&mode=init
POST /1c-exchange/?type=catalog&mode=file&filename=import.zip
GET  /1c-exchange/?type=catalog&mode=import&filename=import.xml

Sequence:

  1. checkauth — 1C checks authorization
  2. init — gets limits (max file size, zip or not)
  3. file — uploads XML files
  4. import — requests import of specific file

Handler Implementation (PHP/Laravel)

class OnecExchangeController extends Controller
{
    public function handle(Request $request)
    {
        $mode = $request->query('mode');

        return match($mode) {
            'checkauth' => $this->checkAuth($request),
            'init'      => $this->init(),
            'file'      => $this->uploadFile($request),
            'import'    => $this->importFile($request),
            default     => response('failure', 400),
        };
    }

    private function checkAuth(Request $request): Response
    {
        if (!$this->validateCredentials($request)) {
            return response("failure\nInvalid login or password");
        }
        $cookie = Str::random(32);
        Cache::put("1c_session_{$cookie}", true, 600);
        return response("success\nCOOKIE\n1c_session={$cookie}");
    }

    private function init(): Response
    {
        return response(implode("\n", [
            'zip=yes',
            'file_limit=' . (32 * 1024 * 1024),
        ]));
    }

    private function uploadFile(Request $request): Response
    {
        $filename = $request->query('filename');
        $request->file('file')->storeAs('1c-exchange', $filename);
        return response('success');
    }

    private function importFile(Request $request): Response
    {
        $filename = $request->query('filename');
        ImportFrom1cJob::dispatch($filename);
        return response('success');
    }
}

XML Parsing

class CommerceMLParser
{
    public function parseImport(string $xmlPath): void
    {
        $xml = simplexml_load_file($xmlPath, 'SimpleXMLElement', LIBXML_NOCDATA);

        foreach ($xml->Каталог->Товары->Товар as $item) {
            $guid = (string) $item->Ид;
            $sku  = (string) $item->Артикул;
            $name = (string) $item->Наименование;

            Product::updateOrCreate(
                ['onec_guid' => $guid],
                ['sku' => $sku, 'name' => $name]
            );
        }
    }
}

Offers Processing (Prices and Stock)

public function parseOffers(string $xmlPath): void
{
    $xml = simplexml_load_file($xmlPath);

    foreach ($xml->ПакетПредложений->Предложения->Предложение as $offer) {
        $guid  = (string) $offer->Ид;
        $price = (float)  $offer->Цены->Цена->ЦенаЗаЕдиницу;
        $stock = (int)    $offer->Количество;

        Product::where('onec_guid', $guid)->update([
            'price' => $price,
            'stock' => $stock,
        ]);
    }
}

Asynchronous Import

Large catalogs (10,000+ products) cannot be processed synchronously — 1C waits several seconds for response. Solution:

  • File saved immediately (uploadFile)
  • importFile returns success immediately
  • Processing runs in background via Laravel Queue
  • Progress available via separate endpoint

Timeline

Product import from one 1C configuration (catalog + prices + stock): 8–12 work days. Includes testing on real customer data and debugging edge cases.