Hi,
I have a module called price_test with this implementation of hook_uc_price_handler()
<?php
function price_test_uc_price_handler() {
$items['alter'] = array(
'title' => t('Default 2 price handler'),
'description' => t('The default handler ...'),
'callback' => 'price_test_price_handler_alter',
);
$items['format'] = array(
'title' => t('Default 2 price handler'),
'description' => t('The default handler ...'),
'callback' => 'price_test_price_handler_format',
);
return $items;
}
?>With this function everything works as I expect it. But when I change this function so that it looks like
<?php
function price_test_uc_price_handler() {
$items['format'] = array(
'title' => t('Default 2 price handler'),
'description' => t('The default handler ...'),
'callback' => 'price_test_price_handler_format',
);
return $items;
}
?>then I get a fatal error. In my oppinion it would be nice to be able to register a formatter without needing to specify an alterer as well. This does not seem to be possible with the current implementation of uc_price(). There is only a very small modification needed in uc_price() to make that possible. Change
<?php
// Alter the price, context, and options.
foreach ($handlers['alterers'] as $alterer) {
$alterer($price_info, $context, $options);
}
?>to
<?php
foreach ($handlers['alterers'] as $alterer) {
if (function_exists($alterer)) {
$alterer($price_info, $context, $options);
}
}
?>What do you think? (I nearly created an issue at http://drupal.org/node/add/project-issue/ubercart but since that page states that feature requests are not allowed there I decided to mention this here.)


