I am looking at updating my website that is running on Opencart 2.3.0.2 to run on Opencart 4.1.0.3.
On version 4.1.0.3 is there away to change it so that the default at checkout is “Guest Checkout” instead of “Register Account”.
I manged to do this on the old 2.3.0.2 version but cannot find any information on how to do it in 4.1.0.3 version.
On version 4.1.0.3 is there away to change it so that the default at checkout is “Guest Checkout” instead of “Register Account”.
I manged to do this on the old 2.3.0.2 version but cannot find any information on how to do it in 4.1.0.3 version.
Use OpenCart 3.0.4.1 which is the most stable version. The OpenCart 4 versions simply still have too many bugs and are still subject to development.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
I would also suggest you move to 3.0.4.1 instead.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Legendary Member
It appears we’ve been repeating the same points multiple times, and the end users don’t seem particularly concerned about using OC 4.X despite the existing bugs. At this stage, I suggest we step back and allow them to proceed as they choose—whether that means troubleshooting on their own or hiring a developer to support their implementation.
Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy.
Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com
It honestly looks like ideally that's how it's coded?
catalog\view\template\checkout\register.twig
Specifically:
However, it looks like:
catalog\controller\checkout\register.php
Sets the account to 1 by default if no account is found in the session:
That means {% if not account %} checked{% endif %} will never be true
The "correct fix" is to change $data['account'] = 1 to $data['account'] = 0;
However, you might want to do this with an event so you don't edit core files.
Otherwise, just edit the register.twig
catalog\view\template\checkout\register.twig
Code: Select all
{% if config_checkout_guest %}
<div class="col mb-3 required">
<div class="form-check form-check-inline">
<input type="radio" name="account" value="1" id="input-register" class="form-check-input"{% if account %} checked{% endif %}/> <label for="input-register" class="form-check-label">{{ text_register }}</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" name="account" value="0" id="input-guest" class="form-check-input"{% if not account %} checked{% endif %}/> <label for="input-guest" class="form-check-label">{{ text_guest }}</label>
</div>
</div>
{% endif %}
Code: Select all
<input type="radio" name="account" value="0" id="input-guest" class="form-check-input"{% if not account %} checked{% endif %}/> <label for="input-guest" class="form-check-label">{{ text_guest }}</label>
catalog\controller\checkout\register.php
Sets the account to 1 by default if no account is found in the session:
Code: Select all
if (isset($this->session->data['customer']['customer_id'])) {
$data['account'] = $this->session->data['customer']['customer_id'];
} else {
$data['account'] = 1;
}
The "correct fix" is to change $data['account'] = 1 to $data['account'] = 0;
However, you might want to do this with an event so you don't edit core files.
Otherwise, just edit the register.twig
Marking as [SOLVED].
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Legendary Member
Who is online
Users browsing this forum: gunownergear and 13 guests