shawn84 Posted September 2, 2010 Share Posted September 2, 2010 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 Link to comment Share on other sites More sharing options...
FIMBLE Posted September 6, 2010 Share Posted September 6, 2010 Thats excellent thank you for the tip, however did you know there is already a similar thing in osC "address Format" ? Sometimes you're the dog and sometimes the lamp post [/url] My Contributions Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.