Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Call Any Address Variable of Current Customer


shawn84

Recommended Posts

Posted

How to use and display an address variable of the current customers default address

 

This line of code does a database query:

 

$address_database_query
= tep_db_query("select entry_firstname as
firstname
, entry_lastname as
lastname
, entry_company as
company
, entry_street_address as
street_address
, entry_suburb as
suburb
, entry_city as
city
, entry_postcode as
postcode
, entry_state as
state
, entry_zone_id as
zone_id
, entry_country_id as
country_id
from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");

 

Now you want to put all that information into an array so it can be used. This is the code:

 

$address_array
= tep_db_fetch_array(
$address_database_query
);

 

Now just assign what data field from the array you want to a variable. This is the code:

 

$street_address
=
$address_array
['
street_address
'];

 

Now you will want to display it somewhere. Just echo the new variable containing the data you want. This is the code:

 

<?php echo
$street_address
;?>

 

Thats it. I would have liked to have found this here, rather than spending a couple hours figuring it out... so hence my posting. If it saves someone else an hour or two, then I'll be happy. Hoped it helped.

 

Peace :D

Archived

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

×
×
  • Create New...