Jump to content
stevel

Country-State Selector

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?

Share this post


Link to post
Share on other sites
Unfortunately, that URL is a private IP so I can't look for myself. Does the refresh work on other pages of your site?

 

nope.. does not refresh on any address page

Share this post


Link to post
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.

Share this post


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


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

Share this post


Link to post
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.

Share this post


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

Share this post


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


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
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']);

Share this post


Link to post
Share on other sites

i have removed the slash is it right what i have done, although it doesn;t show errors

Edited by virtualadz

Share this post


Link to post
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.

Share this post


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

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

×