Jump to content
Zahoor

City Ajax auto complete

Recommended Posts

Hi everybody,

 

I fount this contribution http://addons.oscommerce.com/info/7182/ quite interesting. But for some reason this doesn't seem to work on site I am developing. Help appreciated. I have downloaded the latest verstion available (April 2010) and followed the instructions, but this doesn't got me any where.

 

Hope someone can look into it as it is quity handy and needy script which determines city as your customer enters the postalcode. Script is based on this resource:

 

http://www.geonames.org/export/ajax-postalcode-autocomplete.html

Edited by Zahoor

Share this post


Link to post
Share on other sites

If you are trying to integrate that contribution into a version 2.3.1 store, you will need to make code modifications so it will work with 2.3.1. It was written for RC2a

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

If you are trying to integrate that contribution into a version 2.3.1 store, you will need to make code modifications so it will work with 2.3.1. It was written for RC2a

 

Chris

 

Thanks for the reply, Chris. No, I am not using version 2.3.1, but MS2.2 - it is a heavily modified code so I don't know where it went wrong. Perhaps it could be because of loading also other scripts ? Would appreciate if you have time to have a look at the file. The code is pasted below:

 

<?php
/*
 $Id: account.php,v 1.61 2003/06/09 23:03:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title> <?php $title_bar = $breadcrumb->title(0); 
			if($title_bar != '') 	echo STORE_NAME . ' - ' . $title_bar;
				else
					echo TITLE;?>
</title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<?php
  if (!isset($lng) || (isset($lng) && !is_object($lng))) {
    include_once(DIR_WS_CLASSES . 'language.php');
    $lng = new language;
  }

  reset($lng->catalog_languages);
  while (list($key, $value) = each($lng->catalog_languages)) {
?>
        <link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key.((isset($_GET['cPath']))?'&cPath='.$_GET['cPath']:'').((isset($_GET['manufacturers_id']))?'&manufacturers_id='.$_GET['manufacturers_id']:''); ?>">
         <?php
         }
         ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->

<!--  Start code -->

 <tr><td valign="top">
     <table border="0" cellspacing="0" cellpadding="0">
   <tr><td width="22"><?php echo tep_draw_separator('spacer.gif', '22', '1'); ?></td>
      <td width="185" valign="top">
	    <table border="0" cellspacing="0" cellpadding="0" width="185">
            <tr><td width="8" class="bg9" valign="top"><?=tep_image(DIR_WS_IMAGES.'m26_2.gif')?></td>
                <td width="177" valign="top"><?php require(DIR_WS_INCLUDES . 'column_left.php'); ?></td>
		     </tr>		   															 
		</table>
	   </td>
          <td width="8" class="bg3"><?php echo tep_draw_separator('spacer.gif', '8', '1'); ?></td>
       <td width="800" valign="top">
	    <table border="0" cellspacing="0" cellpadding="0" width="800">
         <tr><td width="800" bgcolor="#FFFFFF">
		 		<?php require(DIR_WS_BOXES . 'panel_top.php'); ?>
				</td></tr>
                   <tr><td width="800" height="31" bgcolor="#F00300">      
                   <span class="tx"><?=HEADING_TITLE?></span></td></tr>
                   <tr><td width="700" bgcolor="#FFFFFF">
                   <? // new infoBoxHeading($info_box_contents, true, false);?>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr><td class="sea_3">

	<table cellpadding="0" cellspacing="0" border="0" width="100%">
<?php
 if ($messageStack->size('account') > 0) {
?>
     <tr>
       <td><?php echo $messageStack->output('account'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }

 if (tep_count_customer_orders() > 0) {
?>


<tr>
       <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo OVERVIEW_TITLE; ?></b></td>
           <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '"><u>' . OVERVIEW_SHOW_ALL_ORDERS . '</u></a>'; ?></td>
         </tr>
       </table></td>
     </tr>

     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="0" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0"  cellspacing="0" cellpadding="2">
             <tr>
               <td class="main" align="center" valign="top" width="130"><?php echo '<b>' . OVERVIEW_PREVIOUS_ORDERS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
   $orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3");
   while ($orders = tep_db_fetch_array($orders_query)) {
     if (tep_not_null($orders['delivery_name'])) {
       $order_name = $orders['delivery_name'];
       $order_country = $orders['delivery_country'];
     } else {
       $order_name = $orders['billing_name'];
       $order_country = $orders['billing_country'];
     }
?>
                 <tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>'">
                   <td class="main" width="80"><?php echo tep_date_short($orders['date_purchased']); ?></td>
                   <td class="main"><?php echo '#' . tep_trans_id($orders['date_purchased'],$orders['orders_id']); ?></td>
                   <td class="main"><?php echo tep_output_string_protected($order_name) . ', ' . $order_country; ?></td>
                   <td class="main"><?php echo $orders['orders_status_name']; ?></td>
                   <td class="main" align="right"><?php echo $orders['order_total']; ?></td>
                   <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('button_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td>
                 </tr>
<?php
   }
?>
               </table></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo MY_ACCOUNT_TITLE; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td width="60"><?php echo tep_image(DIR_WS_IMAGES . 'account_personal.gif'); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') . '">' . MY_ACCOUNT_INFORMATION . '</a>'; ?></td>
                 </tr>
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . MY_ACCOUNT_ADDRESS_BOOK . '</a>'; ?></td>
                 </tr>
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_PASSWORD, '', 'SSL') . '">' . MY_ACCOUNT_PASSWORD . '</a>'; ?></td>
                 </tr>
               </table></td>
               <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo MY_WISHLIST_TITLE; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td width="60"><?php echo tep_image(DIR_WS_IMAGES . 'wishlist_account.gif'); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . '<a href="' . tep_href_link(FILENAME_WISHLIST, '', 'SSL') . '">' . BOX_HEADING_CUSTOMER_WISHLIST_ACCOUNT . '</a>'; ?></td>
                 </tr>
               </table></td>
               <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo MY_ORDERS_TITLE; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td width="60"><?php echo tep_image(DIR_WS_IMAGES . 'account_orders.gif'); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '">' . MY_ORDERS_VIEW . '</a>'; ?></td>
                 </tr>
			 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' ' . MY_ORDERS_DOWNLOAD_REPENT_FORM . '  <a target="_blank" href="pub/angrefristskjema.pdf">' . tep_image(DIR_WS_IMAGES . 'icons/pdf.gif', '.pdf') . '</a>   <a target="_blank" href="pub/angrefristskjema.doc">' . tep_image(DIR_WS_IMAGES . 'icons/word.gif', '.doc') . '</a>'; ?></td>
                 </tr> 
			  </table></td>
               <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo EMAIL_NOTIFICATIONS_TITLE; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td width="60"><?php echo tep_image(DIR_WS_IMAGES . 'account_notifications.gif'); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL') . '">' . EMAIL_NOTIFICATIONS_NEWSLETTERS . '</a>'; ?></td>
                 </tr>
                 <tr>
                   <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL') . '">' . EMAIL_NOTIFICATIONS_PRODUCTS . '</a>'; ?></td>
                 </tr>
               </table></td>
               <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
   </table>

<!-- body_eof //-->
<td></tr></table>

<!-- End code -->

		     </td>
		     <td width="8" class="bg3"><?php echo tep_draw_separator('spacer.gif', '8', '1'); ?></td></tr>		   															 
		 <tr><td valign="top" colspan="2"><?=tep_image(DIR_WS_IMAGES.'m38.gif')?></td>	 
		</table>
	   </td>		   
	   <td width="185" valign="top">
	    <table border="0" cellspacing="0" cellpadding="0" width="185">
         <tr><td width="177" valign="top"><?php require(DIR_WS_INCLUDES . 'column_right.php'); ?></td>
		     <td width="8" class="bg4" valign="top"><?=tep_image(DIR_WS_IMAGES.'m26.gif')?></td></tr>		   															 
		</table>
	   </td>
	   <td width="22"><?php echo tep_draw_separator('spacer.gif', '22', '1'); ?></td></tr>
  </table>
</td></tr>


<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5609688-2");
pageTracker._trackPageview();
</script>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

What changes is needed for this module to function with my installed version FROZEN: osCommerce Online Merchant v2.3.4.1 CE ?
City Ajax Auto Complete  https://apps.oscommerce.com/cTiQG&amp;city-ajax-auto-complete

I paste the instructions in english language here:
I have used chrome auto translate to translate from French to English language.

 

City Ajax Auto Complete

1 ::: Features 
--------------------------------------------- ----------------

This contribution allows the self-completion of the city, region and country fields via the postal code indicated by the customer on the create_account.php page. A javascript code allows the arrival on the page to automatically detect the visitor's country and automatically selects it in the drop-down list of countries. Then the customer completes the registration form, when he completes his postal code the script automatically searches for the city and region concerned by this postal code and enters it in the fields concerned, if several possibilities of cities are found then a list with all cities is placed below the city field it remains only to make its choice. 

This script was found on the internet on the following page: Address Autocomplete with JSON webservice
http://www.geonames.org/export/ajax-postalcode-autocomplete.html

This webservice contains all the data of countries, postal codes and cities and avoids having to create a table containing all these data and avoids overloading our database with the thousands of information necessary for auto-completion, this makes this contribution usable by any user of oscommerce in any country. 
 

2 ::: Files 
--------------------------------------------- ----------------

3 new files and 1 image to upload.
  • catalog / js / city_ajax.js
  • catalog / js / geonamesData.js
  • catalog / js / jsr_class.js
  • catalog / images / progress_arrow.gif
3 files to modify.
  • Catalog / create_account.php
  • catalog / includes / functions / html_output.html
  • catalog / includes / functions / general.php

 

3 ::: Installation 
--------------------------------------------- ----------------
Step 1: Upload File

  1. Upload new files with the folder "js" into the "catalog" directory of your site like this: "catalog / js".
  2. Upload the progress_arrow.gif file to the "catalog / images /" folder like this: "catalog / images / progress_arrow.gif".

 

Step 2: In catalog / stylesheet.css

  1. Open the catalog / stylesheet.css file
  2. Add the following code at the end of the file:

/* City_Ajax_Auto_Complete */
#suggestBoxElement {
    border: 1px solid #8FABFF; 
    visibility:hidden; 
    text-align: left;  
    white-space: nowrap; 
    background-color: #eeeeee;
    cursor: pointer;
}
.suggestions { 
    font-size: 11;
    background-color: #eeeeee;  
}
.suggestionMouseOver { 
    font-size: 11;
    background: blue; 
    color: white;  
}
/* City_Ajax_Auto_Complete */

 

Step 3: In catalog / includes / functions / html_output.php

  1. search for the following function:

    ////
    // Creates a pull-down list of countries
    function tep_get_country_list($name, $selected = '', $parameters = '') {
      $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
      $countries = tep_get_countries();

      for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
        $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
      }

      return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
    }

  2. Replace with:
     

    ////
    // Creates a pull-down list of countries
      function tep_get_country_list($name, $selected = '', $parameters = '') {
        $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
        $countries = tep_get_countries();

        for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
          $countries_array[] = array('id' => $countries[$i]['countries_iso_code_2'], 'text' => $countries[$i]['countries_name']);
        }

        return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
      }

 

Step 4: In catalog / includes / functions / general.php

1. search for the following function:

 

////
// Returns an array with countries
// TABLES: countries
  function tep_get_countries($countries_id = '', $with_iso_codes = false) {
    $countries_array = array();
    if (tep_not_null($countries_id)) {
      if ($with_iso_codes == true) {
        $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name");
        $countries_values = tep_db_fetch_array($countries);
        $countries_array = array('countries_name' => $countries_values['countries_name'],
                                 'countries_iso_code_2' => $countries_values['countries_iso_code_2'],
                                 'countries_iso_code_3' => $countries_values['countries_iso_code_3']);
      } else {
        $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'");
        $countries_values = tep_db_fetch_array($countries);
        $countries_array = array('countries_name' => $countries_values['countries_name']);
      }
    } else {
      $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name");
      while ($countries_values = tep_db_fetch_array($countries)) {
        $countries_array[] = array('countries_id' => $countries_values['countries_id'],
                                   'countries_name' => $countries_values['countries_name']);
      }
    }

    return $countries_array;
  }

 

2. Replace with:

 

////
// Returns an array with countries
// TABLES: countries
  function tep_get_countries($countries_id = '', $with_iso_codes = false) {
    $countries_array = array();
    if (tep_not_null($countries_id)) {
      if ($with_iso_codes == true) {
        $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name");
        $countries_values = tep_db_fetch_array($countries);
        $countries_array = array('countries_name' => $countries_values['countries_name'],
                                 'countries_iso_code_2' => $countries_values['countries_iso_code_2'],
                                 'countries_iso_code_3' => $countries_values['countries_iso_code_3']);
      } else {
        $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'");
        $countries_values = tep_db_fetch_array($countries);
        $countries_array = array('countries_name' => $countries_values['countries_name']);
      }
    } else {
      $countries = tep_db_query("select countries_id, countries_iso_code_2, countries_name from " . TABLE_COUNTRIES . " order by countries_name");
      while ($countries_values = tep_db_fetch_array($countries)) {
        $countries_array[] = array('countries_id' => $countries_values['countries_id'],
                                                             'countries_iso_code_2' => $countries_values['countries_iso_code_2'],
                                   'countries_name' => $countries_values['countries_name']);
      }
    }

    return $countries_array;
  }

 

Step 5: In catalog create_account.php

1. Search:

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

 

2. Replace with:

$input_country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$country_query = tep_db_query("select countries_id, countries_iso_code_2 from " . TABLE_COUNTRIES . " where countries_iso_code_2 = '" . tep_db_input($input_country) . "'");
$country_result = tep_db_fetch_array($country_query);
$country = $country_result['countries_id'];

 

3. Search:

<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

4. Add just below:

<script type="text/javascript" src="js/geonamesData.js"></script>
<script type="text/javascript" src="js/jsr_class.js"></script>
<script type="text/javascript" src="js/city_ajax.js"></script>

 

5. Search:

<body>

 

6. Replace with:

<body onload="setDefaultCountry();">

 

7. Search:

<td class="main"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

 

8. Replace with

<td class="main"><?php echo tep_draw_input_field('postcode','','onblur="postalCodeLookup();"') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

 

9. Search:

<td class="main"><?php echo tep_draw_input_field('city') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>

 

10. Replace with:

<td class="main"><div style="position: relative; z-index: 24;"><?php echo tep_draw_input_field('city','','onfocus="postalCodeLookup();" onblur="closeSuggestBox();"') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?><div style="position: absolute; width: 256px; top: 20px; left: 0px; z-index:25; visibility: hidden;" id="suggestBoxElement"></div></div></td>

 

 

Step 6: Finished !!


The installation is finished !! 

 

I am interested to get this module to function with the responsive version FROZEN:  osCommerce Online Merchant v2.3.4.1 CE.
All answers are interesting.

Share this post


Link to post
Share on other sites

I'm not familiar with that addon so I can't help you with it. Although, as mentioned previously, it is not compatible with the latest oscommerce version so it would need to be converted. You may want to install View Counter instead since it has the pre-fill code  already. 

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

×