Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

My address formatting is wrong


Guest

Recommended Posts

Posted

I just noticed that on the account_history_info.php the address formatting is wrong. This is the address that it shows doesn't include the entire country name.

 

This is a fake address, but I checked it with a valid address & it still shows it like this.

Delivery Address

Jeff Homes

251 Johnson

Vicksburg, Tennessee 385141

U

Shipping Method

Flat Rate (Best Way)

 

This is the code:

				<td class="main"><b><?php echo HEADING_DELIVERY_ADDRESS; ?></b></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

 

I don't see anywhere in that account_history_info.php file where it is querying the db for any data.

Posted
I just noticed that on the account_history_info.php the address formatting is wrong. This is the address that it shows doesn't include the entire country name.

 

This is a fake address, but I checked it with a valid address & it still shows it like this.

 

This is the code:

				<td class="main"><b><?php echo HEADING_DELIVERY_ADDRESS; ?></b></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

 

I don't see anywhere in that account_history_info.php file where it is querying the db for any data.

 

 

Hi

 

Looked in the db and there are the strings part of the format

 

address_format

 

1 $firstname $lastname$cr$streets$cr$city ($postcode)$cr$country 1 $firstname $lastname$cr$streets$cr$city$cr$postcode - $statecomma$country

1 $firstname $lastname$cr$streets$cr$city, $postcode$cr$statecomma$country

1 $firstname $lastname$cr$streets$cr$city, $state $postcode$cr$country

1 $firstname $lastname$cr$streets$cr$postcode $city$cr$country

 

I guess you can find the country name in the zones and edit there,,

 

cheers

 

ps I di a quick check ...it may just be printing the iso country codes,,, not sure how that is fixed but is a good point..

Rusty

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

Posted
Hi

 

Looked in the db and there are the strings part of the format

 

address_format

 

1 $firstname $lastname$cr$streets$cr$city ($postcode)$cr$country 1 $firstname $lastname$cr$streets$cr$city$cr$postcode - $statecomma$country

1 $firstname $lastname$cr$streets$cr$city, $postcode$cr$statecomma$country

1 $firstname $lastname$cr$streets$cr$city, $state $postcode$cr$country

1 $firstname $lastname$cr$streets$cr$postcode $city$cr$country

 

I guess you can find the country name in the zones and edit there,,

 

cheers

 

ps I di a quick check ...it may just be printing the iso country codes,,, not sure how that is fixed but is a good point..

I checked all that too, but even if it was just printing the isco country codes it would be " US " & not " U ".
  • 2 months later...
Posted

I am posting the solution to this. I don't know if anyone else has found it. I seached the forum today & couldn't find a solution for this.

 

 

Find this function in catalog/includes/functions/general.php

 

  function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {
$address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'");
$address_format = tep_db_fetch_array($address_format_query);

$company = tep_output_string_protected($address['company']);
if (isset($address['firstname']) && tep_not_null($address['firstname'])) {
  $firstname = tep_output_string_protected($address['firstname']);
  $lastname = tep_output_string_protected($address['lastname']);
} elseif (isset($address['name']) && tep_not_null($address['name'])) {
  $firstname = tep_output_string_protected($address['name']);
  $lastname = '';
} else {
  $firstname = '';
  $lastname = '';
}
$street = tep_output_string_protected($address['street_address']);
$suburb = tep_output_string_protected($address['suburb']);
$city = tep_output_string_protected($address['city']);
$state = tep_output_string_protected($address['state']);
if (isset($address['country_id']) && tep_not_null($address['country_id'])) {
  $country = tep_get_country_name($address['country_id']);

  if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
	$state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);
  }
} elseif (isset($address['country']) && tep_not_null($address['country'])) {
  $country = tep_output_string_protected($address['country']['title']);
} else {
  $country = '';
}
$postcode = tep_output_string_protected($address['postcode']);
$zip = $postcode;

if ($html) {
// HTML Mode
  $HR = '<hr>';
  $hr = '<hr>';
  if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults
	$CR = '<br>';
	$cr = '<br>';
	$eoln = $cr;
  } else { // Use values supplied
	$CR = $eoln . $boln;
	$cr = $CR;
  }
} else {
// Text Mode
  $CR = $eoln;
  $cr = $CR;
  $HR = '----------------------------------------';
  $hr = '----------------------------------------';
}

$statecomma = '';
$streets = $street;
if ($suburb != '') $streets = $street . $cr . $suburb;
if ($state != '') $statecomma = $state . ', ';

$fmt = $address_format['format'];
eval("\$address = \"$fmt\";");

if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) {
  $address = $company . $cr . $address;
}

return $address;
 }

 

Notice this line of code:

	} elseif (isset($address['country']) && tep_not_null($address['country'])) {
  $country = tep_output_string_protected($address['country']['title']);

 

Change it to this & it will print out the Country name correctly. You are removing this text ['title']

	} elseif (isset($address['country']) && tep_not_null($address['country'])) {
  $country = tep_output_string_protected($address['country']);

Archived

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

×
×
  • Create New...