Set default city and remove country in signup form

Open to all! Ask other shopowners for help.
hertsflowers
Member
Posts: 9
Joined: Mon Aug 28, 2023 8:34 am
Phoenix Version: v1.0.7.18
Has thanked: 6 times

Re: Set default city and remove country in signup form

Post by hertsflowers »

burt wrote: Mon Aug 28, 2023 10:21 am It's not ideal, because you'll always be working with older code, so when you need help, it's code most of us will have forgotten about :D

Each time you ask a question, just *ensure* to state that you are on a modified 1.0.7.18, the codebase engine from 1.0.7.18 (March 2021) to 1.0.8.20 (current release) is changed a lot.

Change the code in the that same hook file to;

Code: Select all

class hook_shop_create_account_cityCountry {

  public function listen_injectBodyEnd() {
    // get the country ID from the ISO code as the country id can change, but 99.9% of the time never will
    $c_query = tep_db_query("SELECT countries_id FROM countries WHERE countries_iso_code_2 = 'GB'");
    $c = tep_db_fetch_array($c_query);

    $countryid = $c['countries_id'];

    $cc = <<<tt
<script>
document.getElementById("inputCity").value = "Bishops Stortford";
document.getElementById("inputState").value = "Hertfordshire";
document.getElementById("inputCountry").value = "{$countryid}";
</script>
tt;

    return $cc;
  }

}
Thank you @burt

This updated code worked better except that the country not is populated.

And thanks for your advice about stating a version. I was looking for somewhere in my profile I could enter my version so it is displayed with my posts and questions like I've seen on some other forums.
Untitled-1.jpg
You do not have the required permissions to view the files attached to this post.


Join The Code Co-op to get access to your library in the Code Co-op Forum
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: Set default city and remove country in signup form

Post by burt »

There are two things you could do to solve this.
It's time for you to "catch a fish and feed yourself" rather than just be given fish to eat.

Take a think about what two things you could do, and do one of them.
Both of those things concern "State/County".
I am not here to build for you.
I am here to build with you. Let's help each other.
hertsflowers
Member
Posts: 9
Joined: Mon Aug 28, 2023 8:34 am
Phoenix Version: v1.0.7.18
Has thanked: 6 times

Re: Set default city and remove country in signup form

Post by hertsflowers »

burt wrote: Mon Aug 28, 2023 12:38 pm There are two things you could do to solve this.
It's time for you to "catch a fish and feed yourself" rather than just be given fish to eat.

Take a think about what two things you could do, and do one of them.
Both of those things concern "State/County".
Thank you for the fishing tips. I have done some fishing and get the city, county, and country populated. However, I am still keen to explore your initial suggestion to hide away that country selection from customers entirely. My baits have not had any success in that area.
admin
Contributor
Posts: 217
Joined: Wed Oct 30, 2019 1:34 pm
Phoenix Version:
Has thanked: 20 times
Been thanked: 22 times

Re: Set default city and remove country in signup form

Post by admin »

hertsflowers wrote: Mon Aug 28, 2023 1:10 pmI have done some fishing and get the city, county, and country populated.
Share what you did to help others.


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