// missing file in previous commit

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8701 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fBrignoli
2011-09-21 15:49:43 +00:00
parent f8989018a7
commit f0dde5e983
+27
View File
@@ -311,5 +311,32 @@ class AddressCore extends ObjectModel
WHERE `id_customer` = '.(int)$id_customer.' AND `deleted` = 0'.($active ? ' AND `active` = 1' : '')
);
}
/**
* Initiliaze an address corresponding to the specified id address or if empty to the
* default shop configuration
*
* @param int $id_address
* @return Address address
*/
public static function initialize($id_address = null)
{
// set the default address
$address = new Address();
$address->id_country = (int)Context::getContext()->country->id;
$address->id_state = 0;
$address->postcode = 0;
// if an id_address has been specified retrieve the address
if ($id_address)
{
$address = new Address((int)$id_address);
if (!Validate::isLoadedObject($address))
throw new Exception('Invalid address');
}
return $address;
}
}