hook_customer_get_id($info)
ecommerce-5--4/docs/developer/hooks/ec_customer.php, line 76
Return a customer which your Customer Type module handles. This may be a customer which e-Commerce has never seen before so you're looking in your external location.
Note: Modules which are ctype 'user' do not need to answer this hook - a workable default is provided by ec_customer_user.inc
$info An array of data that resembles a customer object. It may contain and 'exid' which is the 'external id' of the customer - hence you'd look this up.
An array keyed on 'type' (ie your customer type) and 'exid' (your external id) if it's known.
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
<?php
function hook_customer_get_id($info) {
// Perhaps do something if you don't know the current user.
if (mymodule_user_unknown($info)) {
$_SESSION['mymodule'] = db_next_id('{ec_customer}_mymodule');
}
// Return data to ec_customer.
if (isset($_SESSION['mymodule'])) {
return array(
'type' => 'anonymous',
'exid' => $_SESSION['mymodule'],
);
}
// Other return a dumb default.
return array(
'type' => 'anonymous',
);
}
?>