hook_alloc_get_customer_names(&$txn, $atype = 'billing')
ecommerce-5--4/docs/developer/hooks/ec_receipt.php, line 281
The allocation object provider customer names from an allocation object. Eg. store returns the customers from the transaction object.
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
<?php
function hook_alloc_get_customer_names(&$txn, $atype = 'billing') {
if ($address = $txn->address[$atype]) {
$names = array();
if (!empty($address->firstname) or !empty($address->lastname)) {
$names['fname'] = $address->firstname;
$names['lname'] = $address->lastname;
}
elseif (!empty($address['firstname']) or !empty($address['lastname'])) {
$names['fname'] = $address['firstname'];
$names['lname'] = $address['lastname'];
}
else {
$names = ec_common_split_name($address->fullname);
}
return !empty($names) ? $names : NULL;
}
}
?>