postnl / postnl-magento2

This is the official Magento 2 extension for the logistics company PostNL. Add shipping options and parcelshops to your checkout. Create labels with track and trace functionality from the backend.
58 stars 61 forks source link

[BUG] PostNL shippingmethods custom not working when create shipment in backend #384

Open JoostWan opened 3 months ago

JoostWan commented 3 months ago

To Reproduce Steps to reproduce the behavior:

  1. Set a custom shipping method in the backend option Path: tig_postnl/extra_settings_advanced/allowed_shipping_methods
  2. Place a backend order with the selected custom shipping method.
  3. Create a shipment for the placed order with the custom shipping method.

Now there are no PostNL options available.

Screenshot 2024-05-12 at 22 25 14

In this file is there a check that returns false https://github.com/postnl/postnl-magento2/blob/master/view/adminhtml/templates/shipment/create/options.phtml#L6

This function is checked from the options.phtml and returns false https://github.com/postnl/postnl-magento2/blob/master/Block/Adminhtml/Shipment/OptionsAbstract.php#L92

When you change this for testing to return true the shipping options are visible. But on the next page where you can download the labels there is again a check on shipping method. https://github.com/postnl/postnl-magento2/blob/master/Block/Adminhtml/Shipment/View.php#L62

JorisPostNL commented 3 months ago

Hi @JoostWan,

Thank you for bringing this to our attention! The issue in question is caused by an incompatibility between our plug-in and shipping methods which are not shipping method "PostNL". For this reason we included Flat, Table and Matrix rates in our shipping method, so there would likely be no need for other methods. This leads us to the question what the purpose of your custom shipping method is exactly, could you provide us with some context in this regard? Perhaps there are better/quicker changes we can develop than this which would achieve the same goal. Could you advise why a custom shipping method is preferred in your case?

Kind regards Joris

JoostWan commented 3 months ago

Hi @JorisPostNL

A custom shipping method has been created so that the customer can create an order via the backend with free shipping costs. As far as I know, this is not possible with table rates, where you can specifically indicate this for an order via the backend. Via the frontend, however, it must be a certain amount.

JorisPostNL commented 3 months ago

Hi @JoostWan

Thank you for elaborating on the issue. I have tested it and agree that this could be a useful change to our plug-in. We will discuss this further internally to decide if and when we will place this on our roadmap. Thanks again for providing valuable feedback and suggestions!

Kind regards Joris