netresearch / module-shipping-core

The Netresearch shipping core package is the central component to offer generic functionality as required by all carriers.
Open Software License 3.0
0 stars 1 forks source link

No output of tracking information in shipping mails if they are created via mass action #6

Closed nobodyMO closed 2 years ago

nobodyMO commented 2 years ago

I have now upgraded our shop from PHP7.3 to PHP7.4.30 and Magento from 2.4.3 to 2.4.4 p1. The installed module versions are:

deutschepost/module-addressfactory-m2                             1.3.0      Deutsche Post Direkt Addressfactory for Magento2
deutschepost/module-autocomplete-m2                               1.3.0      Deutsche Post Direkt Autocomplete Integration for Magento2
deutschepost/module-core                                          1.2.0      Deutsche Post Direkt Core Integration for Magento2
deutschepost/module-internetmarke                                 2.3.0      INTERNETMARKE shipping product capabilities for the DHL Paket carrier module
deutschepost/sdk-api-addressfactory                               2.0.0      PostDirekt Addressfactory API
deutschepost/sdk-api-autocomplete-authentication                  1.1.0      Deutsche Post Direkt Addressfactory Autocomplete Authentication SDK
deutschepost/sdk-api-oneclickforapp                               1.1.0      Deutsche Post INTERNETMARKE 1C4A API SDK
deutschepost/sdk-api-oneclickforrefund                            1.1.0      Deutsche Post INTERNETMARKE 1C4R API SDK
deutschepost/sdk-api-prodws                                       1.1.0      Deutsche Post DHL Group Shipping Products API SDK
dhl/module-carrier-paket                                          2.6.1      Carrier implementation for DHL Business Customer Shipping
dhl/module-carrier-paket-returns                                  2.2.1      Carrier implementation for DHL Business Customer Shipping Returns
dhl/module-carrier-update                                         1.1.0      Optional component to assign incoming orders to the DHL Paket carrier.
dhl/module-shipping-core                                          2.2.0      DHL component providing utilities and frameworks for advanced shipping features
dhl/module-unified-tracking                                       2.1.0      Integrate the DPDHL Group tracking web service into Magento® 2 carrier modules.
dhl/sdk-api-bcs                                                   1.3.0      DHL business customer shipping API
dhl/sdk-api-bcs-returns                                           2.1.1      DHL Paket Retoure API SDK
dhl/sdk-api-parcel-management                                     3.1.0      DHL Paket Parcel Management API SDK
dhl/sdk-api-unified-location-finder                               2.1.0      DPDHL Group Unified Location Finder API SDK
dhl/sdk-api-unified-tracking                                      2.2.0      DPDHL Group unified shipment tracking API SDK
dhl/shipping-m2                                                   2.7.0      DHL multi-division shipping extension for Magento 2
netresearch/config-fields-m2                                      1.3.0      A collection of custom config types for Magento 2 system configuration development.
netresearch/jsonmapper                                            v4.0.0     Map nested JSON structures onto PHP classes
netresearch/module-admin-notification-feed                        1.0.0      Admin Notification Feed
netresearch/module-interactive-batch-processing                   1.1.0      Optional component extending the bulk shipment mass action by an additional step that allows to select shipping product and packaging per order.
netresearch/module-shipping-core                                  2.8.1      Netresearch component providing utilities and frameworks for advanced shipping features
netresearch/module-shipping-inventory                             1.1.2      Optional component adding Magento Inventory capabilities to the Netresearch shipping modules.
netresearch/module-shipping-ui                                    2.3.1      Module providing the UI integration for the Netresearch shipping components

The modules of the DHL adapter have also been upgraded to the latest versions. As of M2.4.4, it is unfortunately no longer possible to pass objects to blocks or layouts in email templates (the legacy flag is now useless). Therefore, the tracking numbers are now referenced with the following statement:

{{layout handle="sales_email_order_shipment_track" shipment_id=$shipment_id order_id=$order_id}}

If the label for one or more orders is created via Interactive Mass Action and no shipment has been created before, then no tracking information is included in the email with the shipment notification. If this is sent manually afterwards, then this works as expected.

Version 2.8.1 contains the following fix, which should actually prevent this: DHLGW-1021: fix tracking number in shipment email for bulk action

Nevertheless, the shipment seems to be saved with a delay.

Therefore, I have added the class Magento\Sales\Model\Order\ShipmentRepository; to Netresearch\ShippingCore\Model\BulkShipment\Netresearch\ShippingCore\Model\BulkShipment and added the following lines to the method createShipments:

       foreach ($shipmentCollection as $shipment) {
            $this->shipmentRepository->save($shipment);
        }

With this extension, the emails are now also sent with tracking information. Can you please integrate the change into the class or include something else so that the tracking information is guaranteed to be saved before the template processing for the shipping mail starts.

ngolatka commented 2 years ago

I can confirm this problem. We'll look into it.

Ref DHLGW-1271

ngolatka commented 2 years ago

Thanks for letting us know about this, @nobodyMO The fix will be included in the next release.

We suspect the problem was caused by MC-42758.

mam08ixo commented 2 years ago

A bugfix version 2.8.2 was released.

Updating the Post & DHL Shipping extension (composer update --with-dependencies dhl/shipping-m2) pulls in the new package version.