Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Export state data ..does not seem to work.


rusty1001

Recommended Posts

Posted

Hi all

 

I have used a lot of contibutions or tried to use to export this field and for some reason the state has a problem,

does anyone know why and how to cure it, I can only assume it is a database issue

 

a.entry_state

 

 

thanks

 

Rusty

Rusty

-------------------------------------------

Posted

You probably need to join the table `zones` via `entry_zone_id` - thats how ours work anyhow.

Even at a Mensa convention someone is the dumbest person in the room.

Posted
You probably need to join the table `zones` via `entry_zone_id` - thats how ours work anyhow.

 

thanks is something was making...but other contribs seem to have the problem..

???

all it needs to do it pull the a.entry_state ..everthing else works, cant understand this??

cant see what the difference between this and say city?

 

cheers

 

"SELECT c.customers_id , c.customers_id,
							  c.customers_lastname,
							  c.customers_firstname,c.customers_default_address_id, c.customers_telephone,
				c.customers_fax,c.customers_email_address, c.customers_fax, c.customers_telephone,
a.entry_company, a.address_book_id, a.customers_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_city,
a.entry_state, a.entry_postcode, a.entry_country_id, a.entry_zone_id, z.zone_code, co.countries_name FROM CUSTOMERS c, ZONES z, ADDRESS_BOOK a,
COUNTRIES co WHERE a.entry_zone_id = z.zone_id AND a.entry_country_id = co.countries_id AND c.customers_id = a.customers_id
AND c.customers_default_address_id = a.address_book_id ORDER BY c.customers_lastname, c.customers_firstname";

Rusty

-------------------------------------------

Posted

maybe i'm tired, but I'm not sure if I understood your response - the way to retrieve the state name in that query would be to retrieve z.zone_code for the two letter code and z.zone_name for the full name.

 

Hope this helps ...

Even at a Mensa convention someone is the dumbest person in the room.

Posted
maybe i'm tired, but I'm not sure if I understood your response - the way to retrieve the state name in that query would be to retrieve z.zone_code for the two letter code and z.zone_name for the full name.

 

Hope this helps ...

 

 

Hi thanks

 

All I want to do is 'echo' what has been entered by the form, like the address, the reason is that if they dont spelt it correctly is goes to a default state when exporting...much the same way has an street name,, ?? is that possible? I will .zone_name.. thanks

Rusty

-------------------------------------------

Posted
Hi thanks

 

All I want to do is 'echo' what has been entered by the form, like the address, the reason is that if they dont spelt it correctly is goes to a default state when exporting...much the same way has an street name,, ?? is that possible? I will .zone_name.. thanks

 

z.zone_name works .... :rolleyes: but I see it is from the actually name?( is this coming from the postcode??) What if they spell it wrong..?? it is going to the default state whic his wrong ... is there any way to just have what they wrote ie, a.enty_state(but entry state does not export???) thanks

R

Rusty

-------------------------------------------

Posted

a.entry_city, a.entry_state

 

part of the export code...

customers['entry_street_address']); ?></td>

<td class="dataTableContent"><?php mirror_out($customers[b]['entry_city']); [/b]?></td>

<td class="dataTableContent"><?php mirror_out($customers[[b]'entry_state'])[/[/b]code]

 

zone_name zone_code work ...for state..

 

City works perfectly and state not.... can anyone explain why?? Fix?

 

 

thanks

Rusty

-------------------------------------------

Posted

SYDNEY Australian Capitol Territory 2154

 

 

... this is wrong because they spelt NSW say N SW for example and in the data is it now ACT,(default)

 

surely I am not the only one who has had this problem, I think delivery is quite important in on line sales :)

 

I thought about adding a drop down list....and that is giving me problems with the refresh..

 

 

 

cheers

Rusty

-------------------------------------------

Posted

To get everyone to enter the correct spelling you can create a dropdown of states. This code would work well if you only sell to a few countries but if you added ALL the countries in the world the list would be impossible for the customer to use. You can replace the zone codes (countries) and expand as needed, this example is for Canada and USA. If Australia does not have states listed in the DB you can always add them.

 

In create_account.php

 

Replace;

 

<?php
if (ACCOUNT_STATE == 'true') {
?>
		 <tr>
		   <td class="main"><?php echo ENTRY_STATE; ?></td>
		   <td class="main">
<?php
  if ($process == true) {
 if ($entry_state_has_zones == true) {
   $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']);
   }
   echo tep_draw_pull_down_menu('state', $zones_array);
 } else {
   echo tep_draw_input_field('state');
 }
  } else {
 echo tep_draw_input_field('state');
  }

  if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?>
		   </td>
		 </tr>
<?php
}
?>

 

With;

 

<?php
if (ACCOUNT_STATE == 'true') {
?>
		  <tr>
		  <td class="main"><?php echo ENTRY_STATE; ?></td>
		  <td class="main">
<?php
  $zones_array[] = array('id' => '', 'text' => 'Please Select');
  $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '223' 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']);
  }

  $zones_array2[] = array('id' => '', 'text' => '----------');
  $zones_query2 = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '38' order by zone_name");
  while ($zones_values = tep_db_fetch_array($zones_query2)) {
	$zones_array2[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
  }
  echo tep_draw_pull_down_menu('state', array_merge($zones_array, $zones_array2), 'Please Select');

 if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?>
		  </td>
		</tr>
<?php
}
?>

 

 

In includes/modules/address_book_details.php

 

Replace;

 

<?php
if (ACCOUNT_STATE == 'true') {
?>
	 <tr>
	   <td class="main"><?php echo ENTRY_STATE; ?></td>
	   <td class="main">
<?php
  if ($process == true) {
 if ($entry_state_has_zones == true) {
   $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']);
   }
   echo tep_draw_pull_down_menu('state', $zones_array);
 } else {
   echo tep_draw_input_field('state');
 }
  } else {
 echo tep_draw_input_field('state', tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']));
  }

  if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?></td>
	 </tr>
<?php
}
?>

 

With;

 

<?php
if (ACCOUNT_STATE == 'true') {
?>
		  <tr>
		  <td class="main"><?php echo ENTRY_STATE; ?></td>
		  <td class="main">
<?php
  $zones_array[] = array('id' => '', 'text' => 'Please Select');
  $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '223' 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']);
  }

  $zones_array2[] = array('id' => '', 'text' => '----------');
  $zones_query2 = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '38' order by zone_name");
  while ($zones_values = tep_db_fetch_array($zones_query2)) {
	$zones_array2[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
  }
  if (tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) == "") {
echo tep_draw_pull_down_menu('state', array_merge($zones_array, $zones_array2), 'Please Select');
} else {
  echo tep_draw_pull_down_menu('state', array_merge($zones_array, $zones_array2), tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']));
}

 if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;
?>
		  </td>
		</tr>
<?php
}
?>

 

Zone 223 and 38 are Canada and USA. Now you will have a list of States and Provinces for those countries in the state field which a customer can select the same as the country with no need to refresh.

 

HTH

Posted

Thanks

 

I will give it a go... tried another add and have have a hassle with the refresh...in that,

 

there are a few countries that are involved in this site but I suppose you never know...what about cutomer admin... ?? what will happen to data that is already there and how ill you be able to edit..? does need a tweak too?

 

 

I can undertand why you cannt just export state (they input) like city ot street.??? can that be done?? that would the easiest...

 

 

 

thanks

 

R

Rusty

-------------------------------------------

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...