2

I have main website, where user logins... that time I am creating $_SESSION['useremail'].

My opencart V3.0.3.3 is in folder "Shopping".

I want to autofill email field in opencart (in shopping folder) login page with session value created by $_SESSION['useremail']

How can I achieve this?

focus.style
  • 6,612
  • 4
  • 26
  • 38

1 Answers1

0

You will have to make changes in each controller, where you'd like to insert email from session.

For Login page open /catalog/controller/account/login.php

find

if (isset($this->request->post['email'])) {
  $data['email'] = $this->request->post['email'];
} else {
  $data['email'] = '';
}

Replace with

if (isset($this->request->post['email'])) {
  $data['email'] = $this->request->post['email'];
} elseif (isset($_SESSION['useremail'])  {
  $data['email'] = $_SESSION['useremail'];
} else {
  $data['email'] = '';
}

Now you will get your email from $_SESSION['useremail'] on login page.

If you wish to add those email anywhere else on your OpenCart website - you will have to rewrite $data['email'] in related controllers the same way as above.

focus.style
  • 6,612
  • 4
  • 26
  • 38