Skip to content

Order import and carrier distribution ​

Follow an order from Magento into Logidav, see what happens when it already exists, and then follow each line through carrier selection. This is a map of the reviewed code; the linked pages give the detailed rules and their evidence.

Scope

This journey describes the Menzzo/Magento import and selected shared Logidav logic at the cited source revision. Marketplace services can have their own mapping or overrides. Installed schedules, active flags, deployed revision and real carrier acceptance must be checked in the actual environment.

The journey at a glance ​

View diagram source
flowchart TD
    A[Magento order] --> B[Import: read new orders after cursor]
    B --> C{Already in Logidav?}
    C -->|No| D[Create sale and each line]
    C -->|Yes| E[Update selected sale fields; add missing lines]
    D --> F[Choose real shipping method for each new line]
    E -->|Missing lines only| F
    F --> G[Apply final carrier overrides]
    G --> P{New sale?}
    P -->|Yes| H[New-sale event: possible order-wide regrouping]
    P -->|No| I[Carrier operations and label workflow]
    H --> I
    I --> J[Shipment import and tracking]
    K[Separate Magento status update command] --> E
    L[Address or delivery-mode change] --> M[Recalculate affected line carriers]

Diagram

The diagram is a navigation map: the status-update path calls the existing-sale branch when its conditions match, and grouping is a new-sale event, not a general step for every existing-order update. It does not assert that a carrier has accepted a label or that a parcel was delivered.

Choose the part you need ​

Your questionFollow the workflow
How does an order get imported, and which flag, cursor and command does it use?Sales import and configuration
Is this a new order, an existing order update, or a new line on an existing order?New vs existing orders and line rules
Why was a line assigned to GLS, Chronopost, IDF, floor delivery or another method?Carrier distribution and overrides
Can the customer change from pickup to delivery or floor delivery?Delivery-mode changes
What happens after carrier allocation?Carrier labels, shipment and tracking, shipment generation
Which related custom rules still need investigation?Custom business-rule inventory

New order or update? ​

SituationWhat the reviewed code doesImportant boundary
menzzo:v2:sales fetches an orderSelects the first page of up to 300 Magento orders with entity_id greater than LAST_MAGENTO_ID.This is an import cursor, not a general scan for changes to already imported orders.
Sale does not exist for source and order IDCreates the sale and lines; each new line is assigned a real shipping method. A new-sale event can regroup eligible parcel lines.The sale-level shipping method and line-level real methods are separate values.
Sale already existsUpdates selected sale fields, adds missing lines, and calls the base updateOrderItem() for existing lines.The reviewed base method updates the two Alfy fields; it does not generally refresh every existing line's price, quantity, delivery mode or carrier.
menzzo:v2:sales:update finds a relevant status differenceSelected local Menzzo sales are compared with Magento and the order is passed to addOrder() when the reviewed branch detects a change. A separate bounded recent processing delta query also exists.This is not a universal update feed or a guarantee that every changed line is resynchronized.

See import command, order upsert, and status update command.

Carrier distribution: the short version ​

The line calculator checks ordered conditions involving the requested mode, country and postcode, store, source, supplier and product. It first selects a method such as TRUSK, VIR, RETRAIT, ECO_IDF, CHRONOPOST, ECO_PREVOTE or EXPRESS_CALBERSON; then it applies composition and final overrides. A Chronopost line below 19 kg for product weight × quantity becomes GLS. A later new-sale or specific availability-update path may regroup eligible GLS/Chronopost lines when package counts reach its threshold.

Floor delivery (etage or etage_with_assembly) is initially TRUSK for the defined French IDF departments and VIR otherwise. The complete sequence, department lists, exceptions and subsequent overrides are in carrier assignment. A method value is a routing decision, not confirmation of a printed label or delivered parcel.

Configuration and operational checks ​

Start with Sales import: configuration and triggers. The reviewed source uses MZ_ACTIVATE_SALES_IMPORT and LAST_MAGENTO_ID; it also has lock protection and separate import/update commands. Documented historical crontab entries do not establish the live schedule. For an incident, compare the affected order, import flag, cursor, source logs, saved sale and lines, and the actual downstream shipment; do not advance a cursor or replay an order without the owner's approved procedure.

SymptomFirst place to investigate
An order is missing or has the wrong statusImport cursor, status passes and failure boundaries
A line has an unexpected carrier or floor-delivery methodCarrier rules and precedence and line-item rules
A label or tracking number is missingCarrier operations and API triage
Logidav and Magento shipment states differShipment generation and carrier operations
A shipment is marked sent but the customer disputes deliveryCheck the carrier's tracking or proof of delivery with its owner; a local shipment is not proof of delivery.

Internal developer documentation for Menzzo systems.