Page 1 of 1

Problem getting additional Checkbox in the checkout_shipping.php into $Session variable

Posted: Wed Jan 19, 2022 8:43 am
by loop
Hi All
I made a hook, where I placed a checkbox before the submit button on the checkout_shipping.php (optional shipping addition)

Everything appears fine, it's inside the <form> but my problem is, I cannot get it in the $_SESSION so I can work with it on orders_total.

What do I have to do, that the POST of the checkout_shipping.php will be in the $_Session? ( i saw that the checkout_shipping.php post the option chose to itself, but I do not get where it's processed and where I have to write the $_POST['transport_insurance'] into the $_Session['transport_insurance']

my idea is, to make a additional hook for the checkout_shipping.php where the session variable is written (input_fields are processed) and write there something like:

Code: Select all

if (tep_not_null($_POST['transport_insurance'])) {
				$_SESSION['transport_insurance'] = isset($_POST['transport_insurance']) ? true : false;
			}
but I don't know which hook I can use which is before the redirect to checkout_payment.php

thank you for helping me out

Re: Problem getting additional Checkbox in the checkout_shipping.php into $Session variable

Posted: Wed Jan 19, 2022 9:57 am
by ecartz

Code: Select all

class hook_shop_checkout_shipping_zinsurance {

  public function listen_checkoutStart() {
    if (!empty($_POST)) {
      $_SESSION['transport_insurance'] = isset($_POST['transport_insurance']);
    }
  }

}

Re: Problem getting additional Checkbox in the checkout_shipping.php into $Session variable

Posted: Wed Jan 19, 2022 10:04 am
by loop
THANK YOU!!!! it worked