Post by ahmedattiawd » Tue Aug 02, 2022 11:31 am

Hello all - I need new customer choose between mobile or email when register - What files should be modified?

OC 3.0.3.8

Thanks

Newbie

Posts

Joined
Mon Oct 11, 2021 4:55 pm

Post by paulfeakins » Tue Aug 02, 2022 9:46 pm

ahmedattiawd wrote:
Tue Aug 02, 2022 11:31 am
I need new customer choose between mobile or email when register
Choose what?

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


User avatar
Guru Member
Online

Posts

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

Post by ahmedattiawd » Tue Aug 02, 2022 9:50 pm

User can choose one of them enter email or mobile number when registration - Not required both.

Newbie

Posts

Joined
Mon Oct 11, 2021 4:55 pm

Post by straightlight » Wed Aug 03, 2022 7:57 am

ahmedattiawd wrote:
Tue Aug 02, 2022 9:50 pm
User can choose one of them enter email or mobile number when registration - Not required both.
That would require a larger extension to accomplish this. However, if you're looking for something specific with your registration methods, you could always create a new service request in the Commercial Support section of the forum to get this done as a custom job or use an extension from the Marketplace if you can find one that suits the needs.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » Wed Aug 03, 2022 6:42 pm

ahmedattiawd wrote:
Tue Aug 02, 2022 9:50 pm
User can choose one of them enter email or mobile number when registration - Not required both.
As @straightlight has said above, it would be quite a lot of work to change all of OpenCart so it works without an email address so if you can't find an extension, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.

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


User avatar
Guru Member
Online

Posts

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

Post by ahmedattiawd » Wed Aug 03, 2022 6:49 pm

Thanks

Newbie

Posts

Joined
Mon Oct 11, 2021 4:55 pm

Post by straightlight » Thu Aug 04, 2022 7:32 am

ahmedattiawd wrote:
Wed Aug 03, 2022 6:49 pm
Thanks
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Joe1234 » Fri Aug 05, 2022 9:39 pm

Don't go around paying people to help you with simple things. Just wait a few days and you may get some help. Don't get overwhelmed by OC, remember it all breaks down to php, javascript, and simple "old school" html with one page edits for easy things like this....I guess the twist is figuring out what is simple despite people telling you different.

You can find simple form validation all over the internet. This may not be the "proper" way to do it and if you upgrade you will lose this but this is your shop, you can mess with the code however you want. This can be done more elegantly like having text reveal itself in a <div> instead of a pop up alert, but I did this in 10 min and it's been a while since I messed with javascript. Check back with me in a week or so I'll give you an ocmod so you wont lose it in an upgrade if you really need it. Good luck on your OC journey, you'll need it lol.

Only thing, I don't know if this interferes with the actual registration function...it shouldn't...but if it does, then it isn't simple and go pay someone lol.

I put the validation in the policy agreement checkbox. I didn't run it through rigorous tests, but it should be correct.

In catalog/view/theme/default/template/account/register.twig

Change:

Code: Select all

[quote]<form action="{{ action }}" method="post" enctype="multipart/form-data" class="register-form form-horizontal">[/quote]
To:

Code: Select all

[quote]<form action="{{ action }}" method="post" enctype="multipart/form-data" class="register-form form-horizontal" name="validaate">[/quote]
Change:

Code: Select all

<input id="input-agree" type="checkbox" name="agree" value="1" />
To:

Code: Select all

<input id="input-agree" type="checkbox" name="agree" value="1" onclick="myFunction()" />
Put this at the bottom of your registration page.

Code: Select all

<script type="text/javascript">
    function myFunction() {
	alert("Javascript is working!");
	var testing1 = document.forms["validate"]["telephone"].value;
	var testing2 = document.forms["validate"]["email"].value;
        if ((testing1 == "") && (testing2 == "")) {
            alert("Fill in telephone OR email!");
            return false;
        }
    };
</script>

v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by straightlight » Sun Aug 07, 2022 6:46 am

I wouldn't put any custom code without using an Event.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ahmedattiawd » Wed Aug 10, 2022 5:14 pm

Not solved - I'm working to solve this issue and I'll put the solution.
straightlight wrote:
Thu Aug 04, 2022 7:32 am
ahmedattiawd wrote:
Wed Aug 03, 2022 6:49 pm
Thanks
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.

Newbie

Posts

Joined
Mon Oct 11, 2021 4:55 pm

Post by ahmedattiawd » Wed Aug 10, 2022 5:16 pm

Thanks for your words - I'll try your code and reply back - Thanks for your support.
Joe1234 wrote:
Fri Aug 05, 2022 9:39 pm
Don't go around paying people to help you with simple things. Just wait a few days and you may get some help. Don't get overwhelmed by OC, remember it all breaks down to php, javascript, and simple "old school" html with one page edits for easy things like this....I guess the twist is figuring out what is simple despite people telling you different.

You can find simple form validation all over the internet. This may not be the "proper" way to do it and if you upgrade you will lose this but this is your shop, you can mess with the code however you want. This can be done more elegantly like having text reveal itself in a <div> instead of a pop up alert, but I did this in 10 min and it's been a while since I messed with javascript. Check back with me in a week or so I'll give you an ocmod so you wont lose it in an upgrade if you really need it. Good luck on your OC journey, you'll need it lol.

Only thing, I don't know if this interferes with the actual registration function...it shouldn't...but if it does, then it isn't simple and go pay someone lol.

I put the validation in the policy agreement checkbox. I didn't run it through rigorous tests, but it should be correct.

In catalog/view/theme/default/template/account/register.twig

Change:

Code: Select all

[quote]<form action="{{ action }}" method="post" enctype="multipart/form-data" class="register-form form-horizontal">[/quote]
To:

Code: Select all

[quote]<form action="{{ action }}" method="post" enctype="multipart/form-data" class="register-form form-horizontal" name="validaate">[/quote]
Change:

Code: Select all

<input id="input-agree" type="checkbox" name="agree" value="1" />
To:

Code: Select all

<input id="input-agree" type="checkbox" name="agree" value="1" onclick="myFunction()" />
Put this at the bottom of your registration page.

Code: Select all

<script type="text/javascript">
    function myFunction() {
	alert("Javascript is working!");
	var testing1 = document.forms["validate"]["telephone"].value;
	var testing2 = document.forms["validate"]["email"].value;
        if ((testing1 == "") && (testing2 == "")) {
            alert("Fill in telephone OR email!");
            return false;
        }
    };
</script>

Newbie

Posts

Joined
Mon Oct 11, 2021 4:55 pm

Post by straightlight » Thu Aug 11, 2022 8:40 am

<form action="{{ action }}" method="post" enctype="multipart/form-data" class="register-form form-horizontal" name="validaate">
Typo on validate.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ahmedattiawd » Mon Aug 15, 2022 8:06 am

Hello - Now edited on register.twig to make this options register by phone number or email - But can't validate because disabled this line from register.php in controller folder - how can validate when choose phone or email? See attached image

Attachments

Screenshot 2022-08-15 020618.png

Screenshot 2022-08-15 020618.png (56.36 KiB) Viewed 838 times

Screenshot 2022-08-15 020150.png

Screenshot 2022-08-15 020150.png (42.39 KiB) Viewed 838 times


Newbie

Posts

Joined
Mon Oct 11, 2021 4:55 pm

Post by Joe1234 » Mon Aug 15, 2022 11:19 pm

Did you correct the typo on the form name with the validation?...see above post.

v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am
Who is online

Users browsing this forum: No registered users and 103 guests