HOWTO: Make uc_store load profile addresses if they exist

Posts: 34
Joined: 09/19/2007

I have modified my uc_store.module so that I can use the uc_addresses module during checkout:
Find the function in uc_store called uc_get_address and add these lines below after the line that looks like this:

Look for this line

<?php
$addresses
= array();
?>

Lines to add between the line above and the 'while' line

<?php
if($profile_addresses = uc_addresses_get_address($uid, NULL, 0)){
  foreach(
$profile_addresses AS $index => $profile_address){
   
$addresses[] = (array) $profile_address;
  }
  return
$addresses;
}
?>

This way, the addresses from the users profile that they have created will show in the checkout form. If there are none, the addresses from previous orders will show instead.

Cheers,
Gord.

Storing Address information in User Profile By: bendiy (74 replies) Thu, 10/25/2007 - 19:04