/** * Modify the address book of this address. * * This can only be done if the address book already accepted * the address as one of it's addresses. * * @param UcAddressesAddressBook $addressBook * The address book to move this address to. * * @access public * @return boolean * TRUE on success. * FALSE otherwise. */ public function privChangeAddressBook(UcAddressesAddressBook $addressBook) { foreach ($addressBook->getAddresses() as $address) { if ($address === $this) { // Address appears in address book, changing address book approved. $this->addressBook = $addressBook; return TRUE; } } return FALSE; }
/** * 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' => '')); }