State on user registration form

Ask the community for help and support.
Post Reply
solarsurfer
Posts: 5
Joined: Thu Feb 10, 2022 6:17 am
Has thanked: 1 time

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 ?
heatherbell
VIP Member
VIP Member
Posts: 1996
Joined: Mon Oct 07, 2019 4:39 am
Has thanked: 26 times
Been thanked: 175 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
VIP Member
VIP Member
Posts: 549
Joined: Fri Oct 25, 2019 7:01 pm
Has thanked: 8 times
Been thanked: 49 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
VIP Member
VIP Member
Posts: 1996
Joined: Mon Oct 07, 2019 4:39 am
Has thanked: 26 times
Been thanked: 175 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
Posts: 5
Joined: Thu Feb 10, 2022 6:17 am
Has thanked: 1 time

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
VIP Member
VIP Member
Posts: 605
Joined: Sat Feb 06, 2021 7:38 pm
Has thanked: 80 times
Been thanked: 141 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
Posts: 17
Joined: Fri Jun 25, 2021 6:57 am

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
Posts: 17
Joined: Fri Jun 25, 2021 6:57 am

Re: State on user registration form

Post by superche »

Thank you all,
This has been resolved with an add-on Country State Selector
burt
Lead Developer
Lead Developer
Posts: 2423
Joined: Tue Oct 29, 2019 9:37 am
Has thanked: 49 times
Been thanked: 137 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).
Gamechanger Addon: Queued Emails, try before you buy.
Post Reply