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
| Source | Schedule | Purpose |
|---|---|---|
menzzo:v2:products | Periodic cron | Full catalog synchronization from Magento |
| Stock mutation event | Event-driven | Availability update pushed to marketplaces after stock change |
| Price change event | Event-driven | Price update pushed to marketplaces after price modification |
Components
| Component | File Path | Role |
|---|---|---|
menzzo:v2:products | src/AppBundle/Command/Product/ | Main product sync command -- imports from Magento |
ProductService | src/AppBundle/Services/ProductService.php | Product data management and persistence |
SaleProductAvailabilityService | src/AppBundle/Services/SaleProductAvailabilityService.php | Calculates product availability and delivery dates |
ProductAvailabilityUpdateProcessor | Queue processor | Pushes availability updates to marketplace APIs |
ProductPriceUpdateProcessor | Queue processor | Pushes price updates to marketplace APIs |
Data Types Synced
| Data Type | Direction | Frequency |
|---|---|---|
| Catalog info (name, description, attributes) | Magento -> Logidav -> Marketplaces | On full sync |
| Prices | Magento -> Logidav -> Marketplaces | On change + periodic |
| Stock levels | Logidav -> Marketplaces | On mutation + periodic |
| Images | Magento -> Logidav -> Marketplaces | On full sync |
| Categories | Magento -> Logidav | On full sync |
| Availability / delivery dates | Logidav -> Marketplaces | On 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:
- Container arrival date -- if a container is in transit, use its expected arrival date
dispoClientDate-- explicit customer availability date set by logisticsavailablefield -- general availability flagavailabilityfield -- 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
Productentities with catalog data from Magento - Updates availability and delivery date fields based on the priority chain
Queue
- Enqueues
ProductAvailabilityUpdateProcessorjobs when availability changes - Enqueues
ProductPriceUpdateProcessorjobs 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
- Check product entity data -- query the
Productentity in Logidav to verify that the catalog data matches what is expected from Magento. - Verify queue processor status -- check that
ProductAvailabilityUpdateProcessorandProductPriceUpdateProcessorare running and not backed up. See Queue Debugging. - 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.
- 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.
- Verify availability calculation -- use
SaleProductAvailabilityServiceto check which priority level is determining the availability date. An unexpected container arrival date or staledispoClientDatecan produce wrong delivery estimates. - 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.
Related Commands
| Command | Purpose |
|---|---|
menzzo:v2:products | Main product catalog sync from Magento |
| Marketplace sync commands | Per-marketplace data push |
| Stock sync commands | Stock-specific sync (see Stock Updates) |