Jump to content
stevel

Country-State Selector

Recommended Posts

@dennish

 

Dennis,

 

I just wanted to thank you for your post on here. I spent hours and hours trying different ways to get the countries to pull up the correct states. It was working in my mobile_create_account page from an earlier install, but I could not figure out why it would not work in any other place on my site.

 

The key was the <div id="indicator"> tag. I did not want another image on my site so I completely overlooked that div tag, and omitting it was causing the problem. Here is the thing though, you don't have to have the actual image, but you do need that div tag for the countries to pull up the correct states. So, I just added the div tag itself and everything works!

 

<div id="indicator"></div>

 

Demitry


osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

ok, I've got a new challenge with saving the user-selected state in a session for error checking. I have the user-selected country saved in their session but cannot figure out how to get the state saved as well.

So, when a user enters their information, selects a country and a state from the drop-down menus, then clicks Continue, the error checking brings back the same page (if there are errors) and the states drop-down menu displays "Please Select" ...what I want it to do is display the user's state selection instead.

Here is the code I came up with for the country, and it works great. This is for the order_info.php page, but you can use it on create_account.php or any other page that requires the country & state selection.

  if (isset($_SESSION['order_info']['country']) && $_SESSION['order_info']['country'] != STORE_COUNTRY) {
      $country = $_SESSION['order_info']['country'];
  } else {
      $country = STORE_COUNTRY;
  }

Does anyone have a code solution for retaining the user-selected state on page reload? Any and all help would be greatly appreciated. Thanks.

Demitry
 


osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

is Steve or anyone else supporting this thread??

 

There is an issue with the address_book_process.php when editing an existing address or adding a new address. The problem is with error checking the states drop down menu selection on submit.

 

When submitting that form with the states menu displaying "Please Select" the system will not display a state error because its value is the primary address state. Anyone have a solution for this? Thanks in advance.

 

Demitry


osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

Hello,

I installed  the Country and State selector downloaded from here >> https://apps.oscommerce.com/UT1CL&country-state-selector-bs&v=23 . The contribution works great when creating a new account but doesn't work with the following:

address_book_process.php
checkout_shipping_address.php
checkout_payment_address.php

The issue is the state selector doesn't appear for the above files, although the country default works.  I tried unselecting the options on the backend (admin) then adding them back in... but that didn't work.

My site is running 2.3.4 BS Edge.


Thanks for any insight you may provide.

Share this post


Link to post
Share on other sites
On 7/27/2017 at 0:05 PM, videod said:

Hello,

I installed  the Country and State selector downloaded from here >> https://apps.oscommerce.com/UT1CL&country-state-selector-bs&v=23 . The contribution works great when creating a new account but doesn't work with the following:

address_book_process.php
checkout_shipping_address.php
checkout_payment_address.php

The issue is the state selector doesn't appear for the above files, although the country default works.  I tried unselecting the options on the backend (admin) then adding them back in... but that didn't work.

My site is running 2.3.4 BS Edge.

Ditto Dave (videod)

I hope someone can correct this. I also use 2.3.4 BS Edge.


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

@videod, @spiritalan,

Did you begin with the last full package v2.4.1 and applied all modifications described in the installation instructions.

Edited by raiwa

Share this post


Link to post
Share on other sites
On 8/8/2017 at 1:02 AM, raiwa said:

@videod, @spiritalan,

Did you begin with the last full package v2.4.1 and applied all modifications described in the installation instructions.

I believe so.  Let me double check.  Thanks!

Share this post


Link to post
Share on other sites
On 8/8/2017 at 1:02 AM, raiwa said:

@videod, @spiritalan,

Did you begin with the last full package v2.4.1 and applied all modifications described in the installation instructions.

Actually I first used Country State Selector BS - v2.4.3 followed instruction then. I removed and installed Country State Selector BS - v2.4.1. These are the only instructions, "Upload the files contained in ZIP to server, then install and active the module in Header Tags". I did exactly what the instructions say and I still have the same problem.


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

My version (link posted in the above message) should also work in 2.3.4 non BS. You just need to modify some html around the menu. Compare to your core state menu.

Share this post


Link to post
Share on other sites
Quote

 

Thank you for the help!  Will install and try it out.  Thank you also for the quick reply, much appreciated!


Chris

Share this post


Link to post
Share on other sites

Rainer,

I have one more question you might be able to help with. 

In v. 2.2 when an order was placed the State information showed up as the 2 letters abbreviation (CA, NY, etc.) in the order confirmation email (for Delivery and Billing Addresses).  In v. 2.3.4 it shows up spelled out fully (California, New York, etc.).  I've been looking around to change it back to displaying the 2 letter abbreviation and cannot figure it out.  Any ideas where/how I can make the change?


Chris

Share this post


Link to post
Share on other sites
22 minutes ago, ezfindit said:

In v. 2.2 when an order was placed the State information showed up as the 2 letters abbreviation (CA, NY, etc.) in the order confirmation email (for Delivery and Billing Addresses).  In v. 2.3.4 it shows up spelled out fully (California, New York, etc.).  I've been looking around to change it back to displaying the 2 letter abbreviation and cannot figure it out.  Any ideas where/how I can make the change?

I would say this was done as a customization, if I remember well the full name was always used in a standard store, but I can be wrong.

Anyway, have a look in the database table "zones" and you'll see that there is the full name stored in the column "zone_name" and the abreviation in the column " zone_code".

So you just have to search in create_account.php and the other files where the state name is used for "zone_name" and replace it by "zone_code".

If you know a bit sql you could retrieve the zone_code as zone_name in the sql queries to avoid modifying other code.

Should be something like "zone_code as zone_name"

Edited by raiwa

Share this post


Link to post
Share on other sites

@ezfindit

(while not exactly on topic ...)

30 minutes ago, ezfindit said:

In v. 2.2 when an order was placed the State information showed up as the 2 letters abbreviation (CA, NY, etc.) in the order confirmation email (for Delivery and Billing Addresses).  In v. 2.3.4 it shows up spelled out fully (California, New York, etc.).  I've been looking around to change it back to displaying the 2 letter abbreviation and cannot figure it out.  Any ideas where/how I can make the change?

Is it only in the Order Confirmation email that you want this changed?

M


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

Yes, only the Order Confirmation email, which, once PayPal App is installed, is sent by the paypal_standard.php file.


Chris

Share this post


Link to post
Share on other sites
13 minutes ago, raiwa said:

I would say this was done as a customization, if I remember well the full name was always used in a standard store, but I can be wrong.

Anyway, have a look in the database table "zones" and you'll see that there is the full name stored in the column "zone_name" and the abreviation in the column " zone_code".

So you just have to search in create_account.php and the other files where the state name is used for "zone_name" and replace it by "zone_code".

If you know a bit sql you could retrieve the zone_code as zone_name in the sql queries to avoid modifying other code.

Should be something like "zone_code as zone_name"

Thanks!!!

Edited by ezfindit

Chris

Share this post


Link to post
Share on other sites
3 minutes ago, vampirehunter said:

is this already added to the 2.3.4.1 ce frozen version?

No

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×