Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country-State Selector


stevel
 Share

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

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

  • 2 weeks later...
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

Link to comment
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
Link to comment
Share on other sites

  • 3 weeks later...
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

Link to comment
Share on other sites

  • 11 months later...

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.

Link to comment
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

Link to comment
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
Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 3 weeks later...
3 minutes ago, vampirehunter said:

is this already added to the 2.3.4.1 ce frozen version?

No

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...