Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country-State Selector


stevel

Recommended Posts

ok i can not figure out why the refresh is failing for me. i keep getting this js error

 

Error: form_name.submit is not a function

Source File: https://192.168.2.3/products/checkout_shipping_address.php

Line: 224

 

line 224 looks like this

 

function refresh_form(form_name) {

  form_name.action.value = 'refresh';
  form_name.state.value = '';
  form_name.submit();
  return true;
  }
//--></script>

 

my form html looks like this for this page

 

<form name="checkout_address" action="https://192.168.2.3/products/checkout_shipping_address.php" method="post" onSubmit="return check_form_optional(checkout_address);">

 

the country select box has the proper info

<select name="country" onChange="return refresh_form(checkout_address);">

 

any idea what would cause this?

Link to comment
Share on other sites

Dunno. Do a View Source of the web page in the browser, save it as HTML. Send me the HTML file to the e-mail address in the contribution readme. I'll take a look when I can.

Link to comment
Share on other sites

I too would love to see this contribution work with the affiliate mod. It seems it should be fairly simple to code the affiliate_signup page (trying to study it tonight). Anyone come up with a solution that they can post here?

 

Thanks Steve (GREAT) contribution.

 

Paul

Edited by monsterpatterns
Link to comment
Share on other sites

  • 2 weeks later...

This is a great contribution and great install directions.

However i cant get it to work. I did what u suggested but it doesnt work.

I get JS error.

I am using sts template 2.1

now i added the js function up there but u if u see it has refresh_form(form_name) which is causing issue.

Link to comment
Share on other sites

The link doesn't work for me either.

 

The usual problem for people who use template contribs is that there is a second copy of form_check.js.php used by the template that has to be modified.

Link to comment
Share on other sites

I actually want a simple solution.

I want to show USA and all of its states by default. I wanna show only 2 digit codes. Now i want to have a other box. When they select other, a state text filed shows up and drop down dissapears.

Then they can pick a different country.

Link to comment
Share on other sites

The error you are getting is because the form_check.js.php being used was not updated to include the refresh function. Check the PHP source carefully to see where it comes from.

 

The "simple" solution is more complex coding. You'd have to have an onChange function for the state that looks to see what they selected and if necessary, enables a text box for the other. The two-character states require a change to the query that retrieves the zones.

 

Are you sure this is what you want? It sounds complicated to me.

Link to comment
Share on other sites

Hello,

 

I installed this contri on my Creloaded store (BTS template system). When i read all the posts there are several with problems with this template system. Some have links to their sites where i can actually see it work. I cannot find a solution for this template system so i am stuck. Everything seems to work only on selection of the country the states are not refreshed. I also read to change the main_page.tpl.php but i cannont find a post on this topic how to change it.

Link to comment
Share on other sites

See my reply above, or other posts in this thread regarding template systems. You have to find the actual form_check.js.php file used by your pages and add the refresh function to it.

Link to comment
Share on other sites

I did there are two. One is in catalog/includes/ and the other in catalog/includes/javascript. I changed both but i also was reading form someone that changed the main_page.tpl.php. I am curious what they did but they did not posted the code. Strange thing is that the refresh function is visible in the pagesource

Edited by Noutje
Link to comment
Share on other sites

I actually found a simpler solution. found the AJax state drop down. I customized it to show a box if state is not in the zone table.

 

But just to say that the this state dropdown was the best solution. My sts is screwed up and i ended up using this ajax one.

Link to comment
Share on other sites

  • 1 month later...

hi all, just finished installing and was very happy the way it worked but, just lafter finishing it had a look in the customers section under admin, the page isn't available and shows the following error,

 

Parse error: parse error, unexpected T_CASE in /home/xxxxx/public_html/admin/customers.php on line 195

Link to comment
Share on other sites

hi all, just finished installing and was very happy the way it worked but, just lafter finishing it had a look in the customers section under admin, the page isn't available and shows the following error,

 

Parse error: parse error, unexpected T_CASE in /home/xxxxx/public_html/admin/customers.php on line 195

 

Can you post the code that is around your lines 194 - 196

Link to comment
Share on other sites

Actually, the error is more likely to be earlier in the file - an extra or missing }.

 

no steve eaarlier it was working fine, look at the code

 

i also doubt there is an extra slash, when i looked at your readme, i was also a bit confused

 

lines 183-196

 

} else if ($error == true) {

$cInfo = new objectInfo($HTTP_POST_VARS);

$processed = true;

// +Country-State Selector

} else if ($refresh == 'true') {

$cInfo = new objectInfo($HTTP_POST_VARS);

}

// -Country-State Selector

 

}

 

break;

case 'deleteconfirm':

$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);

Link to comment
Share on other sites

By "earlier" I meant further up in the source - a lower numbered line.

 

I did not say anything about a slash. The character is generally called a "right brace" or "right bracket".

 

Why not compare your customers.php against the pre-edited one I supply? Use a program such as BeyondCompare to do the comparison.

Link to comment
Share on other sites

sorry i mentioned slash instead of "right brace" or "right bracket", i removed the bracket in between these two lines

 

// -Country-State Selector

 

}

 

break;

case 'deleteconfirm':

 

 

 

it doesn't show any errors, what i now ask is have i done this right by removing the bracket, so as it doesn't affect anything else. otherswise everything's fine

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...