Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country-State Selector


stevel

Recommended Posts

I just recently was forced to upgrade my website becaue of register globals, and I have since found some problems that did not exist before in some of the custom code which was hired out. (Some of which was never quite right to begin with, but I could live with it.) I am posting this here because of the familiarity most of you have on the subject of checkout.

 

Anyhow, one of my problems is this.

 

I paid to have an auto-fill feature installed based on zip code. Once a customer clicks on checkout, they are taken to the login screen. They have the option of logging in if they are an existing customer, or entering in their zip code if not. Once they enter in their zip code, they

are taken to the checkout page, which has automatically filled in the state and zip, and city (if only one) or offers a drop-down list of cities to choose from. And this is where my problem lies.

 

Should the customer make a mistake, any mistake at all on the form, the checkout process goes into an endless loop, always asking for the city, even when it has been selected, and everything has subsequently been filled out properly. All other variables seem to be forwarded so that corrections can be made so as to make life easier for the customer, but it always errs out on the city selection. Somehow this is lost. This was a little sloppy and uncommented coding which I am finding hard to follow, especially since I spend more of my time running my business than coding PHP.

 

I am wondering if anyone here cares to take a look and see if they can help me work this out. My guess that it will be a couple of minor changes/additions here or there and should not at all be complicated for a lot of you gurus out there.

 

Your help would be most appreciated.

 

BTW, Steve, your link contribution has served me quite well! Thanks.

 

AJ

Link to comment
Share on other sites

This is a lttle off topic but I am betting someone here can help with this little problem. I am using this fantastic contribution. I also have a notification sent to me when a new customer registers:

"tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);" This code is in creat_account.php.

I get basic customer info:

Client ID: Okay

Name: Okay

E-Mail: Okay

Address: Okay

City: Okay

State: NOT Okay

Country: NOT Okay

Zipcode: Okay

I do not receive City and Country Informtion. This is the code now:

EMAIL_NEW_CLIENT_STATE . ' ' . $state . "\n" .

EMAIL_NEW_CLIENT_ZONE_CODE . ' ' . $country . "\n" .

I have tried everything I can think of and no luck. Would someone tell me what this should be?

Thanks!

Link to comment
Share on other sites

This is a lttle off topic but I am betting someone here can help with this little problem. I am using this fantastic contribution. I also have a notification sent to me when a new customer registers:

You have either $state or $zone_id, depending on whether or not the country has zones. $country is the country ID. So you get the country name with tep_country_name($country) and the state name with tep_get_zone_name($country, $zone_id, 'unknown').

Link to comment
Share on other sites

Sorry for my English, just before... :'(

I've the same problem of refreshing, it does its work on the admin panel, refreshing states, but no on the site.

I made debug on Firefox, but Opera's one seems to be more clear:

 

JavaScript - http://www.xxxxxxxx.it/catalog/create_acco...e57bd828180d5b4

Event thread: change

Error:

name: ReferenceError

message: Statement on line 1: Reference to undefined variable: refresh_form

Backtrace:

Line 1 of script

return refresh_form(create_account);

At unknown location

[statement source code not available]

 

I read a lot of pages in this thread and tried many solutions, but no one works for me.

 

Thanks a lot for you work, however!

Link to comment
Share on other sites

Please look in the README file for the contribution for debugging tips. The error message suggests that the updated form_check.js.php is not being included. You should be able to view the page source and see.

Link to comment
Share on other sites

I've just looked in the README file!

I'm NOT using a template contribution; if I view the source code of teh page I get:

function check_password_new(field_name_1, field_name_2, field_name_3, field_size, message_1, message_2, message_3) {

if (form.elements[field_name_1] && (form.elements[field_name_1].type != "hidden")) {

var password_current = form.elements[field_name_1].value;

var password_new = form.elements[field_name_2].value;

var password_confirmation = form.elements[field_name_3].value;

 

if (password_current == '' || password_current.length < field_size) {

error_message = error_message + "* " + message_1 + "\n";

error = true;

} else if (password_new == '' || password_new.length < field_size) {

error_message = error_message + "* " + message_2 + "\n";

error = true;

} else if (password_new != password_confirmation) {

error_message = error_message + "* " + message_3 + "\n";

error = true;

}

}

}

function refresh_form(form_name) {

form_name.action.value = 'refresh';

form_name.submit();

return true;

}

 

function check_form(form_name) {

if (submitted == true) {

alert("JS_ERROR_SUBMITTED");

return false;

}

I'll send this source code to your mail. Thanks for your interest!

Link to comment
Share on other sites

I am installing the PWA on my site, but according to the instructions for C-SS, there's supposed to be an "extras" folder containing the files for PWA with C-SS. I have tried several PWA contribs, but no extras folder exists in PWA or C-SS.

 

Currently my site has the PWA, but it creates an account using the PWA option. I must be missing something, but I can't find the code I need.

 

Please let me know what I'm missing or where I can get updated files?

 

Thank you.

Anyone can buy a camera... it's what you do with it that counts!

Sticky Pod

www.stickypod.com

Link to comment
Share on other sites

It looks as if PWA has been rewritten by several people and they may have dropped the C-SS addon. There's a file in the PWA contrib list from 12-April that claims to add C-SS. I have not looked at it. The remarks in the C-SS readme refer to the 0.91 version of PWA.

Link to comment
Share on other sites

It looks as if PWA has been rewritten by several people and they may have dropped the C-SS addon. There's a file in the PWA contrib list from 12-April that claims to add C-SS. I have not looked at it. The remarks in the C-SS readme refer to the 0.91 version of PWA.

I thought so and thanks for the response. I decided to drop the PWA altogether. I have the PayPal WPP, C-SS and many customized modifications so it just wasn't worth the effort. Instead I simply rewrote the "New Customer" login area to make it more inviting and user friendly. Feel free to check it out, see what I wrote and use it in your store.

 

I didn't want to mess up the C-SS because it works so well. Whether it's an international order or just across town, this contrib works just the way any store owner would want it to.

 

Thanks for the input and help.

Anyone can buy a camera... it's what you do with it that counts!

Sticky Pod

www.stickypod.com

Link to comment
Share on other sites

Hey Steve,

 

If you have any plans to write more contribs, would you please create a shipping cost preview that can be inserted into the product pages.

 

I know there are some that exist, but in my opinion, they are not well documented and I cannot just replace entire files. You did such a good job documenting all the changes I had to make, it's obvious you have a clear understanding about how to make a good contrib.

 

Think about it. B)

Anyone can buy a camera... it's what you do with it that counts!

Sticky Pod

www.stickypod.com

Link to comment
Share on other sites

Thanks for the kind words. I tend to write contribs that I want for my own store. Are none of the existing contribs any good? I looked at one a while back that went on the shopping cart page but I ended up not using it.

 

I'll agree with you that the majority of contribs I have looked at are poorly put together and documented - what often happens is that the writer takes code from their customized store and shoves it into a zip file, not realizing that they have made other edits (perhaps dependent on other contribs!) that make the new contrib not work. I always test my code and my instructions on a clean install to make sure they work. (Though if you read back through this thread, you'll see evidence that I make mistakes too...)

 

The next idea on my plate is bringing address formats into the real world, but it's a huge task.

Link to comment
Share on other sites

Don't all jump at once now :D

 

I realized that this post may have been inappropriate, and if anyone was offended I apologize. I just thought this might be the closest topic pertaining to my issue and someone here could help me out.

 

Since I have been completely ignored, I guess noone here is interested in helping me solve the problem. I guess that is par for the course with OSC these days.

 

Thanks just the same.

 

AJ,

 

I just recently was forced to upgrade my website becaue of register globals, and I have since found some problems that did not exist before in some of the custom code which was hired out. (Some of which was never quite right to begin with, but I could live with it.) I am posting this here because of the familiarity most of you have on the subject of checkout.

 

Anyhow, one of my problems is this.

 

I paid to have an auto-fill feature installed based on zip code. Once a customer clicks on checkout, they are taken to the login screen. They have the option of logging in if they are an existing customer, or entering in their zip code if not. Once they enter in their zip code, they

are taken to the checkout page, which has automatically filled in the state and zip, and city (if only one) or offers a drop-down list of cities to choose from. And this is where my problem lies.

 

Should the customer make a mistake, any mistake at all on the form, the checkout process goes into an endless loop, always asking for the city, even when it has been selected, and everything has subsequently been filled out properly. All other variables seem to be forwarded so that corrections can be made so as to make life easier for the customer, but it always errs out on the city selection. Somehow this is lost. This was a little sloppy and uncommented coding which I am finding hard to follow, especially since I spend more of my time running my business than coding PHP.

 

I am wondering if anyone here cares to take a look and see if they can help me work this out. My guess that it will be a couple of minor changes/additions here or there and should not at all be complicated for a lot of you gurus out there.

 

Your help would be most appreciated.

 

BTW, Steve, your link contribution has served me quite well! Thanks.

 

AJ

Link to comment
Share on other sites

AJ,

 

You're asking for consulting work that goes beyond "help with a contribution". What I'm guessing you need is to "hire" someone who is willing to work this for you for a fee. (I'm not in that business and don't have the cycles right now to help) Since your issue is not with the Country-State Selector contribution itself, you might try asking in the general discussion part of the forum.

Link to comment
Share on other sites

  • 2 weeks later...

I having problems with the Change Address function of this great contribution...Everything is ok until you get down to the country and state...When the United state is selected it gives me 50+ dropdowns for the state with the correct dropdown being all the way to the right. The first dropdown has Alabama by itself and the second has Alabama and Alaska and it keeps adding a State to each dropdown until it gets to all 50 states at the end...Any help would be appreciated. Here is my site if helps any www.margaritas-video-store.com. Thank you in advance.

Link to comment
Share on other sites

Hi Steve.

 

Tried that already.

 

Fortunately, I have some time on my hands now. I have made some progress towards fixing things myself. At least my customers can checkout now, now I just need to figure out how to hold and return their info when a mistake is made so they do not have to re-fill out all the data, as this is being lost for some reason.

 

If I run up against a brick wall, I'll post my request again in another forum or take it elsewhere.

 

It's a shame that OSC has gotten to the point where noone seems willing to help on the more technical aspects of the program these days, and I personally have contributed $ to hpdl.

 

Oh well..

 

Thanks

 

AJ

 

 

 

 

AJ,

 

You're asking for consulting work that goes beyond "help with a contribution". What I'm guessing you need is to "hire" someone who is willing to work this for you for a fee. (I'm not in that business and don't have the cycles right now to help) Since your issue is not with the Country-State Selector contribution itself, you might try asking in the general discussion part of the forum.

Link to comment
Share on other sites

AJ,

 

In my opinion, you need to rethink the attitude you express here. If you were asking for help with the stock osCommerce software itself, you would probably find such help. If you needed help getting a particular contribution to work, ditto.

 

But what you have instead is that you paid someone to create an unknown customized contribution, which may or may not be based on one of the freely offered ones, and you then complain that nobody is willing to give you free help for it. I'm not sure why you mention that you "personally contributed $ to hpdl" - was this to be payment for future services rendered? I

 

The obvious first step is to go back to whomever it was you paid for this work and ask them to fix it. If you can't or won't do that, then hiring someone else to fix it for you is probably the way to go. I advised someone else recently to do a Google search for "oscommerce freelancers", which brings up lots of hits. This can be a good way to locate someone who claims to be in the business of providing the service you are looking for.

Link to comment
Share on other sites

Karl,

 

It sounds as if you have a coding error on the page where this error occurs. I suggest you compare the code for the state field in includes/modules/address_book_details.php to the one in the pre-edited version of that file supplied in the contribution. My guess is that you have a misplaced close brace.

Link to comment
Share on other sites

advised someone else recently to do a Google search for "oscommerce freelancers", which brings up lots of hits. This can be a good way to locate someone who claims to be in the business of providing the service you are looking for.

Good advice Steve.. by the way, just wanted to re-iterate how handy this contribution is.

 

Thanks

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Hi,

 

Just a quick question please for anyone who can point me in the right direction.

 

At the moment if the contribution is used to select the USA then the 'states' dropbox shows the states and if the UK is selected the states field comes up with the counties (as I installed a UK counties contribution). In both these situations the customer still has to fill the name of the city by manually typing......

 

........ In the case of selecting the UK, how can I arrange for a third dropbox to open that lists the name of the cities/villages that are within the second (counties) dropbox?

 

Here's an example:

 

dropbox1: Select Country (I select UK)

dropbox2: Select State/County (I select Middlesex)

dropbox3: Select City/Village (I select Hayes)

 

I am not too worried about setting up Zones, I just want to keep it simple.

 

I know I will have have to copy/paste a list of all cities/villages per UK County but am not sure where and how to go about adding this to the SQL.

 

Can anyone please give me some pointers?

 

Many Thanks

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

You would copy what is done for the state/zone field. Add a database table zones_to_cities or something like that. If the country is UK, then do a query on the zones_to_cities table to come up with a list of cities for the current zone. You would add the "onChange-refresh" call on the zone dropdown as well (only for UK) so you'd get a new list if the customer changed the county. You'll probably want to add your own version of the tep routines that create the zones dropdown list.

 

An alternative is to create a zone for each city, so the zones list would be much larger for the UK, being ordered by county and then city. This is probably awkward for the customer and you'd have to compensate for it elsewhere when displaying addresses.

 

Or you could consider that the Royal Mail doesn't require the county to be listed at all if the town and postcode are provided. See here.

Link to comment
Share on other sites

Bravo... just the reply I was hoping for Steve.

 

When I get the time I will try to give it a go and see what happens.

 

I understand the Royal Mail situation with addresses as I am from London, UK. The reason I wanted to experiment with a further dropbox with cities was to establish exactly where from each county a customer was from so they could be grouped together.

 

For example, the county of Greater Manchester has many many cities and villages. I just wanted to group together all the customers by narrowing them down from counties to cities so I get more than just an idea of where they are from! I am sure that info could be handy to store owners.

 

Thanks for the prompt reply Steve. :D

Edited by chooch

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

  • 1 month later...

Hi we have been using this contrib for a while its been working good but every once and a while customers complain they cant not add an address.

 

Today i found the page witch is causing this problem but i tried and failed to fix it.

 

https://www.notubes.com/checkout_shipping_address.php

The state is only MA not spelled out Massachusetts like on the other address pages.

 

If i pick NY the page works but if i pick MA it says not a valid state. and with this contrib i thought it was spelled out Massachusetts.

 

Thanks for any help you can give me.

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.

×
×
  • Create New...