State on user registration form

Open to all! Ask other shopowners for help.
Post Reply
solarsurfer

State on user registration form

Post by solarsurfer »

Hi
In the user registration form, the country can be selected from a drop down list.

The drop down list does not show in the "state" field, and reports an error saying "please select from list".

How do I change the state field to show that there is a list to select from, and maybe add "select from list" as the default field entry in the box ?

How can I make the field in "country" to default to "UK" if it is the only field entry anyway ?


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: State on user registration form

Post by heatherbell »

solarsurfer wrote: Fri Feb 11, 2022 8:18 am Hi
In the user registration form, the country can be selected from a drop down list.

The drop down list does not show in the "state" field, and reports an error saying "please select from list".

How do I change the state field to show that there is a list to select from, and maybe add "select from list" as the default field entry in the box ?

How can I make the field in "country" to default to "UK" if it is the only field entry anyway ?
This addon might help - app.php/addons/supporters_code/s03e08_c ... _selector/
Seen in demo here - https://template.me.uk/PRO/S3/create_account.php
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: State on user registration form

Post by 14Steve14 »

Do you have all the relevant states set up on your site so they can be shown.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: State on user registration form

Post by heatherbell »

solarsurfer wrote: Fri Feb 11, 2022 8:18 am How can I make the field in "country" to default to "UK" if it is the only field entry anyway ?
Is UK the only country to which you deliver?
In which case, maybe the State Customer Data module (which I guess you would be using for UK counties) would not be required as counties are no longer required for delivery addresses in UK anyway.
solarsurfer

Re: State on user registration form

Post by solarsurfer »

Hi
Can someone please tell me which php file processes the "user registration" form and sends the data to the sql tables and I can amend the php to get it running right ?

Thanks in advance
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: State on user registration form

Post by Kofod95 »

solarsurfer wrote: Sat Feb 12, 2022 10:43 am Hi
Can someone please tell me which php file processes the "user registration" form and sends the data to the sql tables and I can amend the php to get it running right ?

Thanks in advance
I think here: https://github.com/CE-PhoenixCart/Phoen ... _state.php

In which case it's even better: You can just make a new module to do what you want.
There are in fact not many cases in which you need to amend the core files.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
superche
Member
Posts: 17
Joined: Fri Jun 25, 2021 6:57 am
Phoenix Version:

Re: State on user registration form

Post by superche »

Hi guys, so this should be an easy fix on the first attempt the user does not get a drop download list for state
first go.png
But if you put something in wrong or make a spelling mistake, the drop-down is offered to you?
And I also get the error displayed twice to me
attempt 2.png
attempt2a.png
Questions
1. How do I have the dropdown offered the first time round
2. Why is the user being presented with 2 lines show the error

Thanks Troy
You do not have the required permissions to view the files attached to this post.
superche
Member
Posts: 17
Joined: Fri Jun 25, 2021 6:57 am
Phoenix Version:

Re: State on user registration form

Post by superche »

Thank you all,
This has been resolved with an add-on Country State Selector
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: State on user registration form

Post by burt »

For those having a similar issue in the future;

The states dropdown depends solely on the country dropdown, and whether the selected country has "zones" set up. As an example:

USA would have 50 or so zones (california, wyoming, florida etc).
Australia would have 10 or so zones (western australia, queensland etc).

At the point of registration when the create_account page loads, there is no easy way to know which country the user is from, therefore there is no way to know to load the correct states dropdown.

This means another way must be found to load the states after the country is selected (if you do not like the basic behaviour of Phoenix [reload page asking user to select from list]), which in this case can be done with some javascript (one of which is the PRO addon mentioned above).
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply