Post by supak111 » Tue May 14, 2024 6:15 am

Added a custom email field in checkout STEP-1, just need to pass it to STEP-2.
So customer fills in the email on STEP-1 and clicks CONTINUE to STEP-2. On STEP-2 the email should already be filled in so my abandon carts can do its saving...

I almost got it to work except I have to click LOGIN on STEP-1 to pass: name="emailME
I need to pass it to step-2 by clicking CONTINUE, not LOGIN.

What am I doing wrong? (actually probably a lot). Any suggestions are much appreciated. I suck at coding
Here is my code:

login.twig file I added:

Code: Select all

<div class="form-group required">
<label class="control-label" for="input-payment-email">{{ entry_email }}</label>
<input type="text" name="emailME" value="" placeholder="{{ entry_email }}" id="input-payment-email" class="form-control" />
</div>
.

login.php I added this under public function index():

Code: Select all

if (isset($this->session->data['login']['emailME'])) {
    $data['emailME'] = $this->session->data['login']['emailME'];
} else {
    $data['emailME'] = '';
}
login.php this under public function save()

Code: Select all

$this->session->data['guest']['email'] = $this->request->post['emailME'];
$this->session->data['guest']['emailME'] = $this->request->post['emailME'];
.

guest.twig I change this:

Code: Select all

<input type="text" name="email" value="{{ email }}" placeholder="{{ entry_email }}" id="input-payment-email" class="form-control" />
To this:

Code: Select all

<input type="text" name="email" value="{{ emailME }}" placeholder="{{ entry_email }}" id="input-payment-email" class="form-control" />
guest.php I added this under: public function index()

Code: Select all

if (isset($this->session->data['guest']['emailME'])) {
	$data['emailME'] = $this->session->data['guest']['emailME'];
} else {
	$data['emailME'] = '';
}

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by SohBH » Tue May 14, 2024 3:43 pm

Save the email in the session within the guest.php file under the save method.

View all extensions | Request custom work | Pricing | Contact Me


User avatar
Active Member

Posts

Joined
Mon Nov 02, 2020 12:01 am
Location - Malaysia

Post by supak111 » Tue May 14, 2024 11:00 pm

I thought the code below saves the new email field "emailME" to Sessions. And it does if I click "Login" button on STEP-1, but NOT if I click "Continue" which is what I'm trying to accomplish. Why is that?

Code: Select all

$this->session->data['guest']['email'] = $this->request->post['emailME'];
$this->session->data['guest']['emailME'] = $this->request->post['emailME'];

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm
Who is online

Users browsing this forum: Bing [Bot] and 18 guests