Hi everyone!
I'd like to add a pickup point option to an existing shipping module. Successfully added the map to the DisplayCarrierExtraContent hook, and when the customer select a pickup point i'll call a frontController of the shipping module and pass the address of the pickup point to him.
In the frontController, I extract the current id_address_delivery from the $this->context->cart... and update the delivery address with the pickup point data.
I use the default Prestashop checkout.
The problem: I am in step 3 (Shipping method) when I send the pickup point address to the controller and change the deliveryAddress.
When I press Next, it does not jump to step 4 (Payment) but jumps back to step 3 (Addresses).
I think this is because the deliveryAddress has changed in the meantime.
How to solve this? Shouldn't the address be changed during the ordering process? In this case, when should the deliveryAddress be changed? After the order was successful placed (orderConfirmation hook)?
in the module frontController postProcess()
$deliveryAddress = new Address($this->context->cart->id_address_delivery); $deliveryAddress->address1 = 'New address'; $deliveryAddress->city = 'New city'; .... // it works well without this line -> pressing Next in step3(Shipping method) will jump to step4(Payment). // that is, in case I didn't save the address changes $deliveryAddress->save();
Thanks for the help!
Prestashop 1.7.6