/** * Create a new unowned address. * * This method will create an empty address without an owner. * This is useful when you want to ask an anonymous user for an address * (e.g., when registering). * However, unonwed addresses can not be saved. In order to save this * address, the UcAddressesAddress method setOwner() should be called. * * @access public * @static * @return UcAddressesAddress * A new instance of UcAddressesAddress. */ public static function newAddress() { return UcAddressesAddressBook::newAddress(); }
/** * With this hook you can deliver an array of addresses on which the user * can select one at checkout or when editing the order, depending on the * context $context. * * You can return an array of address arrays or an array of UcAddressesAddress * instances. * * @param int $uid * The user ID to select addresses for. * @param string $context * The context in which the addresses are used: * - checkout_form * - order_form * @param string $type * The type of address to select addresses for (shipping or billing). * * @return array * An array of address arrays or an array of UcAddressesAddress instances. */ function hook_uc_addresses_select_addresses($uid, $context, $type) { // Create and fill an UcAddressesAddress instance. $address = UcAddressesAddressBook::newAddress(); $address->setMultipleFields(array('first_name' => '', 'last_name' => '', 'phone' => '', 'company' => '', 'street1' => '', 'street2' => '', 'city' => '', 'zone' => 0, 'country' => variable_get('uc_store_country', 840), 'postal_code' => '')); // Return an array of address arrays or an array of UcAddressesAddress instances. return array($address, array('first_name' => '', 'last_name' => '', 'phone' => '', 'company' => '', 'street1' => '', 'street2' => '', 'city' => '', 'zone' => 0, 'country' => variable_get('uc_store_country', 840), 'postal_code' => '')); }