netresearch / dhl-shipping-m2

DHL multi-division shipping extension for Magento 2
Open Software License 3.0
13 stars 4 forks source link

Manual insertion of a tracking number #64

Open in-session opened 8 months ago

in-session commented 8 months ago

We have just discovered another small problem. If you enter your own tracking number in the order. And no tracking number has yet been created by the API, a new tracking number is still generated. This means that you then have two tracking numbers. If you want to delete the automatically generated one, a new one will be generated immediately.

image

Perhaps it would be possible to check here whether a tracking number has already been stored?

ngolatka commented 8 months ago

At the moment I don't really understand the purpose of manually entering a tracking number when DHL will generate one anyway.

Are you using the custom tracking number like an order reference? If yes, there's a separate API field for that.

in-session commented 8 months ago

In this case, for example, if a validation fails and we have to initiate the dispatch manually, we create a label in the DHL portal which is then added manually if necessary. If the validation then works, a second label is created. It is then not possible to simply remove the label. After removing the automatically generated label, a new one is created. Here it would be desirable to check whether a label is already stored and then to prevent the automatic generation.

ngolatka commented 8 months ago

Thanks for the explanation! It looks like the double tracking numbers are rather the symptom of the underlying issue, which seems to be a somewhat strange workflow.

You wrote

if a validation fails and we have to initiate the dispatch manually [...] If the validation then works, a second label is created

This sounds to me like you corrected some error in Magento (e.g. a mistake in the shipping address) after already creating the label manually in the DHL portal. Then you triggered the label creation in Magento again. If that is correct, why did you create the label in the DHL portal anyway, instead of doing everything in Magento?

Generally speaking, you should not create a label in the DHL Business Customer Portal and also in Magento. It should only be one or the other – preferably in Magento, so our extension can handle everything, all the correct events get triggered, etc.

in-session commented 8 months ago

We have the labels generated automatically with batch processing, i.e. we do not trigger them per order. In this case you are right that we have corrected the address, as in the other Usses. The label was then generated automatically. We have now tried to delete the automatically generated tracking number as there are now two of them. However, a new one is then generated immediately and we have no way of preventing this in this case. The customer now always receives two tracking numbers.

ngolatka commented 8 months ago

Ok, but then the question still remains: why don't you simply correct the address in Magento and use the batch process again?

If the timing is critical, you could also trigger the label creation for the affected order(s) in Magento, not having to wait for the next run of the cronjob.

To me, that makes the most sense. Just don't manually create the label in the DHL portal at all. Do everything in Magento via our extension to prevent things getting mixed up. That is the way it's supposed to be done.

Or is there anything preventing you from doing it like this? I'd really like to know.

in-session commented 8 months ago

The problem is that due to the use of some payment service providers like klarna, the address can no longer be changed once the order has been submitted:

image

We therefore have no way of correcting the address data.

ngolatka commented 8 months ago

I have to admit that I'm a bit confused.

You wrote

In this case you are right that we have corrected the address, as in the other Usses. The label was then generated automatically.

That sounded to me like you were indeed able to edit the address later. If you can't correct the address in Magento, then you should never get a DHL label via our Magento extension.

But to shorten this: would it be easier if you disabled this option? Then the cronjob would not touch the failed shipments again. You could of course still retry them manually in Magento.

image

in-session commented 8 months ago

That sounded to me like you were indeed able to edit the address later. If you can't correct the address in Magento, then you should never get a DHL label via our Magento extension.

No, I have changed this within the database. But I will contact Klarna again to see if they can reactivate the edit button for the delivery address.

Thanks for your suggestion, I have now deactivated the checkbox and will continue to monitor this.

ngolatka commented 8 months ago

I have changed this within the database.

Ah, I see. Would it then be possible to simply not create a label in the DHL portal, but do it in Magento through our extension, after you made the correction in the DB?