netresearch / dhl-module-ui

Module for providing the presentation layer within the Magento application for custom functionality
Open Software License 3.0
3 stars 0 forks source link

Default Value for Checkboxes #8

Closed jg-development closed 3 years ago

jg-development commented 3 years ago

Hi, it would be nice feature to set a default value for some checkboxes like "parcel notification". dhl-checkbox

The Checkbox "DHL Paketankündigung aktivieren" should be checked by default on our side. If this is not possible, could you provide us with a way too implement this? Greetings Jan

ngolatka commented 3 years ago

If memory serves, it was done like this because DHL specified it.

Enabling that option transmits the buyer's email address to DHL, which the buyer has to agree to willingly, because GDPR.

jg-development commented 3 years ago

ahh you could be right about the gdpr. but besides the problem with it, can you give me a hint for an easy change of the default checked variable? I am not familiar with knockout.js. help would be much appreciated.

mam08ixo commented 3 years ago

In order to modify any of the shipping options in checkout, you would typically register an instance of \Dhl\ShippingCore\Api\ShippingSettings\Processor\Checkout\ShippingOptionsProcessorInterface to the Dhl\ShippingCore\Model\ShippingSettings\Processor\Checkout\CheckoutDataCompositeProcessor via di.xml.

Compare examples in the DHL Paket and DHL ShippingCore modules.

Using a shipping option processor, all the input's properties can be modified. One of these properties is the default value (\Dhl\ShippingCore\Api\Data\ShippingSettings\ShippingOption\InputInterface::setDefaultValue).

jg-development commented 3 years ago

thx I will try it and give feedback ... but with this info, it should be possible without a problem

jg-development commented 3 years ago

did work like a charm ... @mam08ixo thx for the hint ... I was able to add a simple module with the provided di information.

mam08ixo commented 3 years ago

Glad you made it work. Please be aware that the interfaces will be moved/renamed in version 2.

You will have to align your changes to the new structure when upgrading.