SCdenis Posted March 10, 2020 Share Posted March 10, 2020 Hello! i'm running presta 1.7.6.3 and i work on module where on checkout (Carrier tab) open popup where customer can select delivery destination-address (for example - post office) - that work as i expected. - customer select delivery destination (address) we change delivery address over ajax call: $id_of_carrier = Context::getContext()->cart->id_carrier; $id_address_delivery = Context::getContext()->cart->id_address_delivery; $id_address_invoice = Context::getContext()->cart->id_address_invoice; $addressBilling = new Address($id_address_invoice); $address = new Address($id_address_delivery); $newaddress = new Address(); $newaddress->id_customer = $address->id_customer; $newaddress->id_manufacturer = $address->id_manufacturer; $newaddress->id_supplier = $address->id_supplier; $newaddress->id_warehouse = $address->id_warehouse; $newaddress->id_country = $address->id_country; $newaddress->id_state = $address->id_state; $newaddress->country = $address->country; $newaddress->alias = $_POST['in']; $newaddress->company = $address->company; $newaddress->lastname = $address->lastname; $newaddress->firstname = $address->firstname; $newaddress->address1 = $_POST['it']; $newaddress->address2 = $_POST['ipn']; $newaddress->postcode = $_POST['ipi']; $newaddress->city = $_POST['ip']; $newaddress->phone = $address->phone; $newaddress->phone_mobile = $address->phone_mobile; $newaddress->vat_number = $address->vat_number; $newaddress->deleted = 0; $newaddress->force_id = true; $newaddress->other = $_POST['xx']. ":" .$_POST['xxx']; if ($newaddress->add() == true) { //update cart $cart = Context::getContext()->cart; $cart->id_address_delivery = $newaddress->id; $cart->update(); $cart->save(); $cart->setNoMultishipping(); $delivery_option = $cart->getDeliveryOption(); $delivery_option[(int)$newaddress->id] = $id_of_carrier.','; $cart->setDeliveryOption($delivery_option); $cart->save(); } - when proceed (click on continue button) to next step (billing information) presta make redirect to Address tab - that mean we go two steps back. I don't have idea why? Can anyone help me how to prevent redirect to address tab after address is changed over code? Theme and checkout is default - no customizations. Thank you! Link to comment Share on other sites More sharing options...
Giga_Boss Posted April 26, 2020 Share Posted April 26, 2020 Hi, do you have find solution ? I have same problem... Thx Link to comment Share on other sites More sharing options...
WebMorda Posted September 29 Share Posted September 29 (edited) $address = new Address($cart->id_address_delivery); if (Validate::isLoadedObject($address)) { $address->city = $city; $address->address1 = $warehouse; $address->update(); } $checksum = $this->cartChecksum->generateChecksum($cart); $data = [ 'checkout-personal-information-step' => [ 'step_is_reachable' => true, 'step_is_complete' => true, ], 'checkout-addresses-step' => [ 'step_is_reachable' => true, 'step_is_complete' => true, 'use_same_address' => true, ], 'checkout-delivery-step' => [ 'step_is_reachable' => true, 'step_is_complete' => false, ], 'checkout-payment-step' => [ 'step_is_reachable' => false, 'step_is_complete' => false, ], 'checksum' => $checksum, ]; Db::getInstance()->update('cart', [ 'checkout_session_data' => pSQL(json_encode($data)) ], 'id_cart = ' . (int) $cart->id); The previous version did not work properly. Edited September 29 by WebMorda (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now