zeberrun Posted September 17, 2011 Posted September 17, 2011 hello, my country state selectors codes are shown below for older version. java script in create account php goes to getir php. when customer selects country, customer can see the state options. i have java script in create account.php <script language="javascript"><!-- var req; function loadXMLDoc(key) { var url="getir.php?ShptsiD=<?php echo tep_session_id();?>&country="+key; getObject("states").innerHTML = ' <img style="vertical-align:middle" src="images/downlad.gif"> please wait...'; try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { req = null; } } if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); } if (req != null) { req.onreadystatechange = processChange; req.open("GET", url, true); req.send(null); } } function processChange() { if (req.readyState == 4 && req.status == 200) { getObject("states").innerHTML = req.responseText; } } function getObject(name) { var ns4 = (document.layers) ? true : false; var w3c = (document.getElementById) ? true : false; var ie4 = (document.all) ? true : false; if (ns4) return eval('document.' + name); if (w3c) return document.getElementById(name); if (ie4) return eval('document.all.' + name); return false; } //--></script> i also replaced country and state lines with below <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?></td> <td class="main"><?php echo tep_get_country_list('country', '', 'onchange="loadXMLDoc(this.value);" style="width:150px" '); ?></td> </tr> <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_STATE; ?></td> <td class="main"> <?php echo '<div id="states">'; echo tep_draw_pull_down_menu('state', $zones_array,'', ' class="inputBox" style="width:175px" '); echo '</div>'; ?> i have getir.php for countries selection <?php // Released under the GNU General Public License require('includes/application_top.php'); $country = $_GET['country']; $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } header('Content-type: text/html; charset='.CHARSET); if ( tep_db_num_rows($zones_query) ) { echo tep_draw_pull_down_menu('state', $zones_array,'', ' class="inputBox" style="width:160px" '); } else { echo 'no record'; } ?> but in 2.3.1 i did like this. in create account.php require('includes/form_check.js.php'); i added require('includes/state_check.js.php'); i also replaced country and state lines with below <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?></td> <td class="main"><?php echo tep_get_country_list('country', '', 'onchange="loadXMLDoc(this.value);" style="width:150px" '); ?></td> </tr> <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_STATE; ?></td> <td class="main"> <?php echo '<div id="states">'; echo tep_draw_pull_down_menu('state', $zones_array,'', ' class="inputBox" style="width:175px" '); echo '</div>'; ?> i have includes/state_check.js.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ ?> <script type="text/javascript"><!-- var req; function loadXMLDoc(key) { var url="getir.php?ShptsiD=<?php echo tep_session_id();?>&country="+key; getObject("states").innerHTML = ' <img style="vertical-align:middle" src="images/yukleniyor.gif"> Lütfen Bekleyin...'; try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { req = null; } } if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); } if (req != null) { req.onreadystatechange = processChange; req.open("GET", url, true); req.send(null); } } function processChange() { if (req.readyState == 4 && req.status == 200) { getObject("states").innerHTML = req.responseText; } } function getObject(name) { var ns4 = (document.layers) ? true : false; var w3c = (document.getElementById) ? true : false; var ie4 = (document.all) ? true : false; if (ns4) return eval('document.' + name); if (w3c) return document.getElementById(name); if (ie4) return eval('document.all.' + name); return false; } //--></script> i have getir.php for countries selection <?php // Released under the GNU General Public License require('includes/application_top.php'); $country = $_GET['country']; $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } header('Content-type: text/html; charset='.CHARSET); if ( tep_db_num_rows($zones_query) ) { echo tep_draw_pull_down_menu('state', $zones_array,'', ' class="inputBox" style="width:160px" '); } else { echo 'no record'; } ?> it hangs on please wait... what is wrong with this?
zeberrun Posted September 17, 2011 Author Posted September 17, 2011 adminstrator pls delete this topic.
zeberrun Posted September 17, 2011 Author Posted September 17, 2011 sorry pls not delete i thought i could solve it in default 2.3.1 create account.php. i need the solution because i could not do it. what is wrong above?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.