Skip to main content

Product Sync

What It Does

This workflow keeps the product catalog synchronized between Magento 2, Logidav, and all connected marketplaces (Amazon, Cdiscount, ManoMano). It imports product data from Magento, processes it through Logidav, and pushes catalog information, prices, stock levels, and availability to each marketplace via queue-based processors.

How It Connects

Trigger

SourceSchedulePurpose
menzzo:v2:productsPeriodic cronFull catalog synchronization from Magento
Stock mutation eventEvent-drivenAvailability update pushed to marketplaces after stock change
Price change eventEvent-drivenPrice update pushed to marketplaces after price modification

Components

ComponentFile PathRole
menzzo:v2:productssrc/AppBundle/Command/Product/Main product sync command -- imports from Magento
ProductServicesrc/AppBundle/Services/ProductService.phpProduct data management and persistence
SaleProductAvailabilityServicesrc/AppBundle/Services/SaleProductAvailabilityService.phpCalculates product availability and delivery dates
ProductAvailabilityUpdateProcessorQueue processorPushes availability updates to marketplace APIs
ProductPriceUpdateProcessorQueue processorPushes price updates to marketplace APIs

Data Types Synced

Data TypeDirectionFrequency
Catalog info (name, description, attributes)Magento -> Logidav -> MarketplacesOn full sync
PricesMagento -> Logidav -> MarketplacesOn change + periodic
Stock levelsLogidav -> MarketplacesOn mutation + periodic
ImagesMagento -> Logidav -> MarketplacesOn full sync
CategoriesMagento -> LogidavOn full sync
Availability / delivery datesLogidav -> MarketplacesOn change + periodic

Step-by-Step Flow

Availability Calculation

:::info Priority chain for availability dates SaleProductAvailabilityService determines product availability using a priority chain. The first non-null value wins:

  1. Container arrival date -- if a container is in transit, use its expected arrival date
  2. dispoClientDate -- explicit customer availability date set by logistics
  3. available field -- general availability flag
  4. availability field -- fallback availability indicator

This priority chain ensures that the most specific and actionable date is always used for customer-facing delivery estimates. :::

// Usage example
$availabilityService = $this->get('mz.saleproductavailability');
$dispo = $availabilityService->getProductDispo($saleProduct);
$deliveryInfo = $availabilityService->getOrderDeliveryInfo($saleProduct);

Side Effects

Database

  • Creates or updates Product entities with catalog data from Magento
  • Updates availability and delivery date fields based on the priority chain

Queue

  • Enqueues ProductAvailabilityUpdateProcessor jobs when availability changes
  • Enqueues ProductPriceUpdateProcessor jobs when prices change
  • Queue processors run on their own schedules -- see Queue Model

External Systems

  • Pushes catalog updates to Amazon, Cdiscount, and ManoMano via their respective APIs
  • Syncs data back to Magento when bidirectional sync is configured

Failure Modes

:::warning Marketplace API rate limiting Marketplace APIs (especially Amazon) enforce strict rate limits. If a large catalog sync triggers too many API calls, subsequent updates are throttled or rejected. The queue processors should implement backoff, but monitor for persistent failures. :::

:::warning Catalog mismatch If a product exists in Logidav but not on a marketplace (or vice versa), the sync will fail for that product. This is common when new products are created in Magento but not yet listed on all marketplaces. Failed products are logged but do not block the rest of the sync. :::

:::warning Image sync failure Image URLs from Magento may be invalid, expired, or unreachable from the marketplace's perspective. Failed image syncs do not block catalog updates but result in products without images on the marketplace. :::

:::danger Price update delay If the ProductPriceUpdateProcessor queue is backed up or failing, marketplace prices can become stale. Stale prices are a revenue risk -- customers may purchase at an outdated (lower) price or abandon carts due to an inflated price. :::

Debugging Path

  1. Check product entity data -- query the Product entity in Logidav to verify that the catalog data matches what is expected from Magento.
  2. Verify queue processor status -- check that ProductAvailabilityUpdateProcessor and ProductPriceUpdateProcessor are running and not backed up. See Queue Debugging.
  3. Check marketplace API responses -- inspect logs for HTTP status codes and error messages from marketplace APIs. Rate limiting returns 429; authentication failures return 401/403.
  4. Compare Logidav vs marketplace catalog -- for a specific product, compare the data in Logidav with what appears on each marketplace. Discrepancies indicate a sync failure.
  5. Verify availability calculation -- use SaleProductAvailabilityService to check which priority level is determining the availability date. An unexpected container arrival date or stale dispoClientDate can produce wrong delivery estimates.
  6. Check for orphaned queue jobs -- look for queue entries that have been retried multiple times without success. These may indicate a persistent data issue with specific products.
CommandPurpose
menzzo:v2:productsMain product catalog sync from Magento
Marketplace sync commandsPer-marketplace data push
Stock sync commandsStock-specific sync (see Stock Updates)