Post by supak111 » Fri Feb 21, 2025 11:16 am

Is it possible to auto-fill a text file on a page via visiting the URL directly and by adding a query to the URL?

Say by visiting account login page at:
site.com/index.php?route=account/login

Can I add a query to URL to fill in the email-address field?
I was thinking maybe changing the URL to something like this:
site.com/index.php?route=account/login?email=Auto-Fill-Email-Field@gmail

How can I make this work?

.
Last edited by supak111 on Sat Feb 22, 2025 1:48 am, edited 1 time in total.

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by nonnedelectari » Fri Feb 21, 2025 4:25 pm

supak111 wrote:
Fri Feb 21, 2025 11:16 am
Is it possible to auto-fill a text file on a page via visiting the URL directly and by adding a query to the URL?

Say by visiting account login page at:
site.com/index.php?route=account/login

Can I add a query to URL to fill in the email-address field?
I was thinking maybe changing the URL to something like this:
site.com/index.php?route=account/login?email=Auto-Fill-Email-Field@gmail

How can I make this work?

.
That would then be:
site.com/index.php?route=account/login&email=Auto-Fill-Email-Field@gmail

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by paulfeakins » Fri Feb 21, 2025 8:35 pm

supak111 wrote:
Fri Feb 21, 2025 11:16 am
Is it possible to auto-fill a text file on a page via visiting the URL directly and by adding a query to the URL?
Yes.

supak111 wrote:
Fri Feb 21, 2025 11:16 am
How can I make this work?
You need some code on the page that detects if those URL variables are set and then sets the value attribute of the inputs to it.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by supak111 » Sat Feb 22, 2025 1:47 am

Ok thanks guys, got it to work ツ

In theme view change:

Code: Select all

<input type="text" name="email" value="" required="required" id="emailField" class="form-control" />
TO:

Code: Select all

<input type="text" name="email" value="{{ email|e }}" required="required" id="emailField" class="form-control" />


In the controller file add this to in "public function index() {"

Code: Select all

// Check if 'email' exists in the GET request
$email = isset($this->request->get['email']) ? $this->request->get['email'] : '';

// Pass to the Twig template
$data['email'] = $email;

~ 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: paola_84 and 16 guests