Product catalog synchronization between website and marketplaces

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

Catalog Synchronization Between Website and Marketplaces

Manually maintaining current catalogs on 3–5 marketplaces is unrealistic with large product ranges. A synchronization system transmits new products, updates changes in descriptions and attributes, and removes discontinued items.

Mapping Data Schema

CREATE TABLE marketplace_product_mappings (
    id              BIGSERIAL PRIMARY KEY,
    product_id      BIGINT REFERENCES products(id),
    marketplace     TEXT,              -- 'ozon', 'wb', 'ym'
    external_id     TEXT,              -- ID on marketplace
    external_sku    TEXT,              -- SKU on marketplace (may differ)
    status          TEXT,              -- 'active', 'pending', 'error', 'removed'
    last_synced_at  TIMESTAMPTZ,
    sync_hash       CHAR(64),          -- SHA-256 of synced fields
    error_message   TEXT,
    UNIQUE (product_id, marketplace)
);

Change Detection

class ProductChangeDetector
{
    // Fields whose changes require re-synchronization
    private array $trackFields = [
        'name', 'description', 'brand', 'sku', 'price',
        'category_id', 'attributes', 'images'
    ];

    public function hasChanges(Product $product, string $marketplace): bool
    {
        $mapping = $product->marketplaceMappings()->where('marketplace', $marketplace)->first();
        if (!$mapping) return true;  // new product — needs sync

        $currentHash = $this->computeHash($product);
        return $currentHash !== $mapping->sync_hash;
    }

    private function computeHash(Product $product): string
    {
        $data = $product->only($this->trackFields);
        $data['images'] = $product->images->pluck('url')->sort()->values()->all();
        return hash('sha256', json_encode($data, JSON_SORT_KEYS));
    }
}

Category Mapping

Each marketplace has its own category tree. Without mapping, products cannot be listed:

class CategoryMapper
{
    // Stored in DB, managed through UI
    public function getMarketplaceCategory(int $siteCategoryId, string $marketplace): ?int
    {
        return DB::table('category_mappings')
            ->where('site_category_id', $siteCategoryId)
            ->where('marketplace', $marketplace)
            ->value('marketplace_category_id');
    }

    // For Ozon, use name-based search
    public function suggestOzonCategory(string $categoryName): array
    {
        return Http::withHeaders($this->ozonHeaders)
            ->post('https://api-seller.ozon.ru/v1/description-category/search', [
                'language' => 'DEFAULT',
                'query'    => $categoryName,
            ])
            ->json('result');
    }
}

Synchronization Handler

class CatalogSyncJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue;

    public int $tries   = 3;
    public int $backoff = 300;  // retry in 5 minutes

    public function handle(): void
    {
        $products = Product::where('active', true)->get();
        $detector = app(ProductChangeDetector::class);

        foreach (['ozon', 'wb', 'ym'] as $marketplace) {
            $toSync = $products->filter(fn($p) => $detector->hasChanges($p, $marketplace));

            $toSync->chunk(50)->each(function ($chunk) use ($marketplace) {
                $adapter = $this->getAdapter($marketplace);
                foreach ($chunk as $product) {
                    try {
                        $adapter->upsertProduct($product);
                        $this->updateMapping($product, $marketplace, 'active');
                    } catch (Exception $e) {
                        $this->updateMapping($product, $marketplace, 'error', $e->getMessage());
                        Log::error("Catalog sync failed", compact('marketplace', 'e'));
                    }
                }
            });
        }
    }
}

Synchronization Status Dashboard

-- Current catalog state by marketplaces
SELECT
    marketplace,
    COUNT(*) FILTER (WHERE status = 'active')  AS active,
    COUNT(*) FILTER (WHERE status = 'pending') AS pending,
    COUNT(*) FILTER (WHERE status = 'error')   AS errors,
    MAX(last_synced_at) AS last_sync
FROM marketplace_product_mappings
GROUP BY marketplace;

Timeline

Catalog synchronization system for 3 marketplaces with dashboard: 18–24 business days.