tig-nl / gls-magento2

Integrate GLS shipping services into Magento 2. Add GLS shipping and parcelshops to your checkout. Create your labels with Track and Trace functionality from the Magento backend.
5 stars 8 forks source link

[BUG] ShopDeliveryService create label breaks with new setting GLS mass-actions for non GLS orders? #32

Open SolsWebdesign opened 2 years ago

SolsWebdesign commented 2 years ago

Customer updated to latest GLS and suddenly packages were returned. Turns out that the packages being returned were returned from Parcel shops. A little investigation showed that the labels were incorrect, they should contain "ShopDeliveryService" and a GLS code for the shop of choice. Quite some searching and adding of logging it turns out that in the TIG\GLS\Service\Label\Create class the mapLabelData function ends up in the fallback and then is set to "DefaultGLSOptions": $deliveryOption = $this->getDefaultGLSOptions($shipment);

It took quite a bit of searching before we ended up with one setting that caused this: GLS mass-actions for non GLS orders -> Yes

I have no clue what that setting is supposed to do but I'm pretty sure it should not mess up ParcelShop deliveries. Now this is a multi store Magento so it could be that is has something to do with the bit of previous code (storeId) but I didn't investigate that any further.

Steps to reproduce the behavior:

  1. Go to 'Magento2.4.x multi store' -> Stores -> Configurations -> Sales -> GLS -> GLS mass-actions for non GLS orders -> Yes
  2. Go to frontend of multi store, throw stuff in cart go to checkout and choose GLS -> Parcel shop (Pakket shop), choose one and place order
  3. Go to backend, ship order and press create Label

Expected result Label should contain "ShopDeliveryService" and a GLS code for the shop. As well as something saying "will be collected by..." image

Actual result Label looks suspiciously empty, seems that the Parcelshop address is being used as the actual person address instead of the Parcel shop being a place to collect it. As a consequence the packages are being returned to sender. image

Workaround Do not use the GLS setting "GLS mass-actions for non GLS orders" in (multi store?) magento shop if you want to use the Parcel shop delivery options

Screenshots If applicable, add screenshots to help explain your problem.

Please complete the following information

tig-jeffreybranderhorst commented 2 years ago

Hey @SolsWebdesign,

Thank you for submitting this! I just tested this on our test site with your steps and was able to reproduce the issue when GLS mass-actions for non GLS orders is on, With it off we get the right label. I'm going to place this on the backlog, and we will investigate this further and make en fix for future release.

Thank you for submitting this issue with the steps to reproduce it!

Have a great day, Jeffrey