Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country-State Selector


stevel

Recommended Posts

Interesting.  I'll poke at this tonight and see what I can figure out.  In the meantime, search includes/functions for tep_get_source_list and make sure you are INCLUDEing the file that defines it. My guess is that it's a function that is added as part of the other contribution and you need to make sure it is defined.

 

It appears you were right, it wasn't defined. I defined it and it seems to work now. Thanks. I did a byte-by-byte comparison of all the two contribution files with what I had up on the net and found several word wrap problems as well as file revision differences between my copy of MS2.2 and a clean install of MS2.2 install. This last part has me worried, so I guess I am going to have to check every single file now :-(

 

Thanks again for pointing me in the correct direction.

Link to comment
Share on other sites

I am hoping someone will help me in this forum - I have tried the 2checkout forum and no one is answering.

 

I believe this maybe to do with the Country-State Selector Contribution, but I am not sure. If it is not, perhaps someone knows the answer or can direct me to who might be able to help.

 

I have the 2checkout payment module contribution installed and also Country State selector contribution When an order is sent to 2co, it lists the billing address with a 2 digit state code and then the shipping address taking the first two letters of the long version of the state name.

For example - New York - 2 digit - NY but just taking the first two letters of the long version is Ne

 

As a result, I am having to wait as fraud checks each order out as it thinks that they are two different states.

 

 

How can I set things up to only allow the 2 digit state code in the create account section ?

Link to comment
Share on other sites

Just something to think about for the next update...

 

Add the State selector to customers.php so when the admin edits customers information, he/she can quickly select a state.

 

If I get time this week, I'll try my hand at a hack and post my results here (if it doesn't look like being too complicated for someone without code skills :D )

Link to comment
Share on other sites

I'm having the same problem others mentioned earlier. After installing, the fist entry in my address book is blank. After playing around with it for awhile, I figured I would just install the files that come with the contribution and install my changes to those files. But I get the same result. I tried comparing the files in the contribution to the instructions and found that the checkout_shipping_address.php included with the contribution doesn't match. This is from the instructions:

catalog/checkout_shipping_address.php

 

Line 199

 

Replace:

 

// if no shipping destination address was selected, use their own address as default

if (!tep_session_is_registered('sendto')) {

  $sendto = $customer_default_address_id;

}

with:

 

// +Country-State Selector

if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'refresh')) {

  if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);

  if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);

  $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);

  $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);

  $street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);

  if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);

  $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);

  $city = tep_db_prepare_input($HTTP_POST_VARS['city']);

  $country = tep_db_prepare_input($HTTP_POST_VARS['country']);

  if (ACCOUNT_STATE == 'true') {

    if (isset($HTTP_POST_VARS['zone_id'])) {

      $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);

    } else {

      $zone_id = false;

    }

    $state = tep_db_prepare_input($HTTP_POST_VARS['state']);

  }

} else

  // -Country-State Selector

// if no shipping destination address was selected, use their own address  as default

  if (!tep_session_is_registered('sendto')) {

    $sendto = $customer_default_address_id;

  }

  // +Country-State Selector

  if (!isset($country)){$country = DEFAULT_COUNTRY;}

  // -Country-State Selector

But that code isn't in the included file. So I'm confused at this point as to where the problem might be. Any suggestions.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Ok, first things first,

 

Jack_mcs, you are absolutely right - a chunk of code is missing from the pre-edited files. I don't know how that happened and you have my sincere apologies. I will upload a new ZIP file with that fixed.

 

On the other hand, where did people complain about an entry in the address book being blank? I don't recall that (and can't spot it in the thread.) Please describe the problem in more detail, and if you would, send me a PM with a URL of your store I can try so I can see the problem.

 

sheepiedog, I don't know how the 2checkout contribution works, but Country-State Selector does not change the way that states are stored in the database. There are two ways it can be in there. If the ZONE_ID is zero, then the STATE is the spelled out state name. If the ZONE_ID is not zero, then the STATE is null and the ZONE_ID specifies the zone. Knowing the zone, you can get the full name or the abbreviation from the Zones table.

 

What may be happening is that 2checkout assumes that the STATE field is always filled in, because in the default distribution, the ZONE_ID is rarely, if ever, filled in. But I would have expected others to run into a problem before this - CS Selector has been around for quite a while now. If you want to PM me and send the PHP file that 2checkout uses to extract the address info, I'll take a look to see what pops out at me.

Link to comment
Share on other sites

Ok, first things first,

 

Jack_mcs, you are absolutely right - a chunk of code is missing from the pre-edited files.  I don't know how that happened and you have my sincere apologies.  I will upload a new ZIP file with that fixed.

NP. Been there, done that. :)

 

On the other hand, where did people complain about an entry in the address book being blank?  I don't recall that (and can't spot it in the thread.) Please describe the problem in more detail, and if you would, send me a PM with a URL of your store I can try so I can see the problem.
The first mention is on page one, in the bottom third of the page. There was at least one other but on skimming the thread now, I can't find it. However, it appears the problem is caused by something in my EasyPHP setup. If I access my shop via EasyPHP on my computer, I get the missing data problem. But if I view it from my host, it appears fine - same files in both shops.

 

Since that is all that matters, I will shelve this until I have time to look inot it. Good job on the contribution Steve. I have one suggestion though. The install instructions say at line..., do this. But once that first change is made, the rest of the line numbers are invalid. If you reverse the order, it would make for a slightly easier installation. Or, maybe just a note to tell them to do as I did and read the changes from the bottom to the top.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The way I approached the line number thing was that you're supposed to have a "clean" copy of the file from 2.2-MS2 to use as a reference. So many people have already added or modified things, that making ANY assumptions about the file being edited is risky.

 

I keep a copy of the original distribution separate from my site files, and load selected files in Dreamweaver when I want to look at line numbers. I also use BeyondCompare to check differences.

Link to comment
Share on other sites

Just wanted to say that I have instaled the latest version today. No problems and all seems hunky dory. I have the 'where did you hear about us' mod as well as many others installed. using BBedit compare function made the task relatively painless.

 

thanks. Looks great.

Link to comment
Share on other sites

I'm having a problem. I've downloaded this contrib and I thought I had it working ok, but I think it's not....I have people from outside of the US trying place orders on my site but when they go to the create account screen and choose their country, the US states still show up. The system forces them to choose something in the US states box even though none of them are applicable to their country. How do I fix this?

 

Thanks a bunch!

 

Billie :D

Link to comment
Share on other sites

You didn't install the contrib correctly. I'm guessing that the JavaScript change was not made or was made incorrectly. If you can give me a link to your site, I can probably figure it out.

Link to comment
Share on other sites

You have replaced the form_check.js.php with something completely different, or your page is including some different file. Instead of all of the functions in form_check.js.php being included, there's just one function which doesn't resemble the one of the same name in the standard file. Perhaps, if you're using a template system, you need to apply the edit for form_check.js.php to whatever JavaScript is included in your new page.

Link to comment
Share on other sites

You have replaced the form_check.js.php with something completely different, or your page is including some different file.  Instead of all of the functions in form_check.js.php being included, there's just one function which doesn't resemble the one of the same name in the standard file.  Perhaps, if you're using a template system, you need to apply the edit for form_check.js.php to whatever JavaScript is included in your new page.

Thanks...let me try replacing that again. I don't believe that I have anything that should be conflicting with that. I'll try again see what happens...

Link to comment
Share on other sites

Thanks...let me try replacing that again.  I don't believe that I have anything that should be conflicting with that.  I'll try again see what happens...

That fixed it! Thanks so much! Is there anyway to get it so it's not a required input field? I changed the minimum characters to 0 in admin, but if you don't put something in the box, it still gives you an error message. Thanks so much for the help!!!

Link to comment
Share on other sites

I downloaded this contribution today and installed the included files. When I attempted to create a test account and changed the country the page doesn't refresh. I have a javacode error on bottom page bar.

 

I made two changes to the js file nothing major.

 

Thanks for any help you can give me.

Link to comment
Share on other sites

This is cool however wen I install and changed the Application_top.php to what you said about "select Country" this is wat Happend in the account creation area

 

1062 - Duplicate entry 'babc9e2cef8b83ac919cfce2704e055d' for key 1

 

insert into sessions values ('babc9e2cef8b83ac919cfce2704e055d?osCAdminID=9d2d8d68465cd7456c9d1970fd4f2aeb', '1103439204', 'cart|O:12:\"shoppingcart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"USD\";navigation|O:17:\"navigationhistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:18:\"create_account.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:6:\"osCsid\";s:76:\"babc9e2cef8b83ac919cfce2704e055d?osCAdminID=9d2d8d68465cd7456c9d1970fd4f2aeb\";}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:0:{}}')

 

[TEP STOP]

 

1062 - Duplicate entry 'babc9e2cef8b83ac919cfce2704e055d' for key 1

 

insert into sessions values ('babc9e2cef8b83ac919cfce2704e055d?osCAdminID=9d2d8d68465cd7456c9d1970fd4f2aeb', '1103439210', 'cart|O:12:\"shoppingcart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"USD\";navigation|O:17:\"navigationhistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:18:\"create_account.php\";s:4:\"mode\";s:3:\"SSL\";s:3:\"get\";a:1:{s:6:\"osCsid\";s:76:\"babc9e2cef8b83ac919cfce2704e055d?osCAdminID=9d2d8d68465cd7456c9d1970fd4f2aeb\";}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:0:{}}')

 

[TEP STOP]

 

 

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

 

 

Can Anyone HELP!? what seems to be the problem? I have removed the lines

define('ENTRY_STATE_TEXT', '* (Select country first)');

define('ENTRY_COUNTRY_TEXT', '* (Page will refresh when changed)');

 

from the application_top.php file but it is still happening

 

Thanks

Link to comment
Share on other sites

Annette, that JavaScript error is the clue. The best tool I have found for diagnosing this sort of thing is to install the Firefox browser, then try the page you're having problems with. From the Tools menu, select "JavaScript Console". There you'll likely see a clear error message that should lead you to the fix.

 

Henry, exactly what change did you make? This contribution does not include a change to application_top.php.

Link to comment
Share on other sites

stevel,

 

great job again (i love your login a la amazon contrib).

 

i would simply suggest one thing, and then you can tell me what do you think about it.

 

(if i didn't make mistakes :D ), when i select one country, i see in the zone field the first one of the list.

is it possible to display as default item a "select please" instead of the first zone of that country?

 

let me know.

 

thank for your effort

 

p.s. aside: i posted on my blog about kitty angels, as a thank you for these contributions.

 

bye

Link to comment
Share on other sites

Stefano,

 

Thanks for the kind words and the reference to Kitty Angels.

 

What you want should not be difficult. Let me think about it for a while and I'll get back to you. The harder part is not allowing the user to leave it as "please select", but I know how to do that.

Link to comment
Share on other sites

Annette, that JavaScript error is the clue.  The best tool I have found for diagnosing this sort of thing is to install the Firefox browser, then try the page you're having problems with.  From the Tools menu, select "JavaScript Console".  There you'll likely see a clear error message that should lead you to the fix.

 

Henry, exactly what change did you make?  This contribution does not include a change to application_top.php.

 

This is wat was included in the Download of the Country-state-selector

As an alternative, you could add this in catalog/includes/application_top.php.

 

You may also want to change the following definitions similar to the following:

 

define('ENTRY_STATE_TEXT', '* (Select country first)');

define('ENTRY_COUNTRY_TEXT', '* (Page will refresh when changed)');

 

So I added that line in the application_top.php

 

thats wat I did and after the error I removed it but the error is still there

Thanks.. I need Help FAST

Link to comment
Share on other sites

How did you add this? What tool did you use to do the editing? You didn't use the File Manager in admin, did you?

 

I would guess that you should upload a clean copy of the file, which you can get from the osCommerce distribution you used.

Link to comment
Share on other sites

How did you add this?  What tool did you use to do the editing?  You didn't use the File Manager in admin, did you?

 

I would guess that you should upload a clean copy of the file, which you can get from the osCommerce distribution you used.

 

 

Thats excatly what I used! tis a bad thing to do? where shd I edit files then?

Thanks, but before I changed I copied the content to notepad and saved as application_top.php and after the error I uploaded that but it wont work

Link to comment
Share on other sites

Yes, that's a bad thing. File Manager corrupts PHP files. Please delete file_manager.php from your admin folder on your site. Not only is it broken, but it is a security risk.

 

Instead, you should download the file, edit it on your local PC, and then upload the changed copy. Better still, you should have a local copy of your entire site's files, so all you need do is edit the local copy and upload the change.

 

Send me your saved application_top.php in a PM and I'll see if I can fix it for you.

Edited by stevel
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...