Post by thanos74 » Thu Sep 20, 2018 5:12 pm

Hello, i want to set email "not required" at checkout. It is possible ?

New member

Posts

Joined
Thu Nov 05, 2015 4:55 pm

Post by kestas » Thu Sep 20, 2018 5:22 pm

thanos74 wrote:
Thu Sep 20, 2018 5:12 pm
Hello, i want to set email "not required" at checkout. It is possible ?
You mean, guest checkout? Yes, is possible by editing corresponding core files.

Cheers

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by thanos74 » Thu Sep 20, 2018 5:39 pm

Yes, guest checkout. Can you help me please ?
kestas wrote:
Thu Sep 20, 2018 5:22 pm
thanos74 wrote:
Thu Sep 20, 2018 5:12 pm
Hello, i want to set email "not required" at checkout. It is possible ?
You mean, guest checkout? Yes, is possible by editing corresponding core files.

Cheers

New member

Posts

Joined
Thu Nov 05, 2015 4:55 pm

Post by kestas » Thu Sep 20, 2018 5:44 pm

in catalog/view/theme/default/template/checkout/guest.twig
find:

Code: Select all

<div class="form-group required">
replace with:

Code: Select all

<div class="form-group">
in catalog/controller/checkout/guest.php
find:

Code: Select all

if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
				$json['error']['email'] = $this->language->get('error_email');
			}
replace with:

Code: Select all

/*
if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
				$json['error']['email'] = $this->language->get('error_email');
			}
*/
then clear your cache in admin dashboard and refresh modifications.

cheers

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by thanos74 » Thu Sep 20, 2018 6:05 pm

1st thank you very much for your help!

I did that but i still see "required" at my email...
The url path at my browse at checkout is "/index.php?route=checkout/checkout".

You wrote bellow to replace with

Code: Select all

<div class="form-group">
. I replaced only the email field. Am i right?
Also i'm using Journal2 theme. I replaced in catalog/view/theme/journal/template/checkout/guest.twig
and then at catalog/view/theme/default/template/checkout/guest.twig
but still nothing...

kestas wrote:
Thu Sep 20, 2018 5:44 pm
in catalog/view/theme/default/template/checkout/guest.twig
find:

Code: Select all

<div class="form-group required">
replace with:

Code: Select all

<div class="form-group">
in catalog/controller/checkout/guest.php
find:

Code: Select all

if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
				$json['error']['email'] = $this->language->get('error_email');
			}
replace with:

Code: Select all

/*
if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
				$json['error']['email'] = $this->language->get('error_email');
			}
*/
then clear your cache in admin dashboard and refresh modifications.

cheers

New member

Posts

Joined
Thu Nov 05, 2015 4:55 pm

Post by kestas » Thu Sep 20, 2018 6:15 pm

. I replaced only the email field. Am i right?
Yes You are right. It is my fault... i have not indicated which tag.
You not mentioned about which theme you are using...
So you need in journal theme controller file comment this also.
in: catalog/controller/journal2/checkout.php
find:

Code: Select all

if ((utf8_strlen($data['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $data['email'])) {
            $errors['email'] = $this->language->get('error_email');
        } else if ($register && $this->model_account_customer->getTotalCustomersByEmail($data['email'])) {
            $errors['email'] = $this->language->get('error_exists');
        }
and replace with:

Code: Select all

/*
if ((utf8_strlen($data['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $data['email'])) {
            $errors['email'] = $this->language->get('error_email');
        } else if ($register && $this->model_account_customer->getTotalCustomersByEmail($data['email'])) {
            $errors['email'] = $this->language->get('error_exists');
        }
*/
do not forget clear cache and refresh modifications

Cheers

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by thanos74 » Thu Sep 20, 2018 6:28 pm

I did it, but i have "interval server error".
If i complete anything at email field, not necessary a valid email, then i don't have the error...
Something is wrong...
I think it can't be null... As i see at firefox console, i have the error "TypeError: "json is null""

kestas wrote:
Thu Sep 20, 2018 6:15 pm
. I replaced only the email field. Am i right?
Yes You are right. It is my fault... i have not indicated which tag.
You not mentioned about which theme you are using...
So you need in journal theme controller file comment this also.
in: catalog/controller/journal2/checkout.php
find:

Code: Select all

if ((utf8_strlen($data['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $data['email'])) {
            $errors['email'] = $this->language->get('error_email');
        } else if ($register && $this->model_account_customer->getTotalCustomersByEmail($data['email'])) {
            $errors['email'] = $this->language->get('error_exists');
        }
and replace with:

Code: Select all

/*
if ((utf8_strlen($data['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $data['email'])) {
            $errors['email'] = $this->language->get('error_email');
        } else if ($register && $this->model_account_customer->getTotalCustomersByEmail($data['email'])) {
            $errors['email'] = $this->language->get('error_exists');
        }
*/
do not forget clear cache and refresh modifications

Cheers

New member

Posts

Joined
Thu Nov 05, 2015 4:55 pm

Post by kestas » Thu Sep 20, 2018 6:55 pm

Ok . when you asking something, you need post all what you are use... OC version, Theme, checkout options and so on. (Forum rules). Of course I have not checked this solution for mail "not required", with quick checkout. So I need to check it.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by thanos74 » Thu Sep 20, 2018 6:58 pm

Sorry my friend...
My OC is 3.0.2.0 , im using Journal2 2.7.6 and quick checkout.
Thank you very much!
Waiting for your reply...
kestas wrote:
Thu Sep 20, 2018 6:55 pm
Ok . when you asking something, you need post all what you are use... OC version, Theme, checkout options and so on. (Forum rules). Of course I have not checked this solution for mail "not required", with quick checkout. So I need to check it.

New member

Posts

Joined
Thu Nov 05, 2015 4:55 pm

Post by kestas » Thu Sep 20, 2018 7:21 pm

do not use this my suggestion:
in: catalog/controller/journal2/checkout.php
find:
Code: Select all

Code: Select all

if ((utf8_strlen($data['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $data['email'])) {
            $errors['email'] = $this->language->get('error_email');
        } else if ($register && $this->model_account_customer->getTotalCustomersByEmail($data['email'])) {
            $errors['email'] = $this->language->get('error_exists');
        }
and replace with:
Code: Select all

Code: Select all

/*
if ((utf8_strlen($data['email']) > 96) || !preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $data['email'])) {
            $errors['email'] = $this->language->get('error_email');
        } else if ($register && $this->model_account_customer->getTotalCustomersByEmail($data['email'])) {
            $errors['email'] = $this->language->get('error_exists');
        }
*/
it is wrong!!! do not use it. Sorry.

You can use only first my suggestion for the default checkout.
I have checked and It's best to ask for help this theme developer. If they not help you can back here.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 84 guests