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

Open to all! Ask other shopowners for help.
Post Reply
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

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

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

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

Post 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']);
    }
  }

}
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

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

Post by loop »

THANK YOU!!!! it worked


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply