Appearance
Magento 2 Integration
Magento 2 serves as the primary e-commerce front-office. It is the main source of customer orders, and Logidav synchronizes products, stock, and shipment tracking back to it via SOAP and REST API connections.
Role
- Order source: Logidav imports Magento orders via
mz.sale.api - Status synchronization: status changes in Magento are reflected in Logidav
- Product catalog: products are synchronized between Magento and Logidav
- Stock updates: Logidav pushes current inventory levels to Magento
- Shipment tracking: tracking numbers are sent back to Magento when shipments are created
Components
| Component | File | Role |
|---|---|---|
MenzzoApi | src/CoreBundle/Api/MenzzoApi.php | Magento API client (v1) |
MenzzoApiV2 | src/CoreBundle/Api/MenzzoApiV2.php | Magento API client (v2) |
SaleService | src/CoreBundle/Services/SaleService.php | Order processing logic |
| Configuration | app/config/parameters.yml | API URLs and credentials |
Data Flow
Inbound: Order Import
View diagram source
sequenceDiagram
participant MAG as Magento 2
participant API as mz.sale.api
participant CMD as menzzo:v2:sales
participant SVC as SaleService
participant DB as Database
CMD->>CMD: Read last imported Magento ID
CMD->>API: GET orders (entity_id > last_id)
API->>MAG: API request
MAG-->>API: JSON payload
API-->>CMD: Order list
CMD->>SVC: addOrder(payload, isV2Data=true)
SVC->>DB: Persist Sale + SaleProducts
Inbound: Status Updates
View diagram source
sequenceDiagram
participant CMD as menzzo:v2:sales:update
participant API as mz.sale.api
participant MAG as Magento 2
CMD->>CMD: Load local sales
CMD->>API: GET orders by IDs
API->>MAG: API request
MAG-->>API: Updated statuses
API-->>CMD: Compare statuses
CMD->>CMD: Update if changed
Outbound: Stock and Tracking
Logidav pushes stock levels and shipment tracking numbers back to Magento through the same API clients. Stock updates run on a schedule; tracking numbers are pushed as soon as a carrier label is generated.
Key Commands
| Command | Schedule | Description |
|---|---|---|
menzzo:v2:sales | Every 10 min | Import new orders from Magento |
menzzo:v2:sales:update | Every 30 min | Synchronize order statuses |
menzzo:v2:sales:payment | Scheduled | Process payment information |
menzzo:v2:products | Scheduled | Synchronize product catalog |
Configuration
The Magento API is configured through the mz.sale.api service parameters. Check parameters.yml for the API URLs and credentials.
yaml
magento:
api_url: "https://..."
api_user: "..."
api_key: "..."SOAP vs REST
The v1 client (MenzzoApi) uses SOAP, while the v2 client (MenzzoApiV2) uses REST. New integrations should use the v2 client wherever possible.
Error Handling
| Scenario | Behavior |
|---|---|
| API timeout | Retry on next scheduled run |
| Duplicate order ID | Skipped during import |
| Invalid product data | Logged and skipped |
| Authentication failure | Alert raised; check credentials in parameters.yml |