You are here

function hook_order_actions in Ubercart 6.2

Same name and namespace in other branches
  1. 5 docs/hooks.php \hook_order_actions()

Adds links to local tasks for orders on the admin's list of orders.

Parameters

$order: An order object.

Return value

An array of specialized link arrays. Each link has the following keys:

  • name: The title of page being linked.
  • url: The link path. Do not use url(), but do use the $order's order_id.
  • icon: HTML of an image.
  • title: Title attribute text (mouseover tool-tip).
2 functions implement hook_order_actions()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

uc_order_actions in uc_order/uc_order.module
Return the actions a user may perform on an order.
uc_shipping_order_actions in shipping/uc_shipping/uc_shipping.module
Implements hook_order_actions().
1 invocation of hook_order_actions()
uc_order_actions in uc_order/uc_order.module
Return the actions a user may perform on an order.

File

docs/hooks.php, line 811
These are the hooks that are invoked by the Ubercart core.

Code

function hook_order_actions($order) {
  $actions = array();
  $module_path = base_path() . drupal_get_path('module', 'uc_shipping');
  if (user_access('fulfill orders')) {
    $result = db_query("SELECT nid FROM {uc_order_products} WHERE order_id = %d AND data LIKE '%%s:9:\"shippable\";s:1:\"1\";%%'", $order->order_id);
    if (db_num_rows($result)) {
      $title = t('Package order !order_id products.', array(
        '!order_id' => $order->order_id,
      ));
      $actions[] = array(
        'name' => t('Package'),
        'url' => 'admin/store/orders/' . $order->order_id . '/packages',
        'icon' => '<img src="' . $module_path . '/images/package.gif" alt="' . $title . '" />',
        'title' => $title,
      );
      $result = db_query("SELECT package_id FROM {uc_packages} WHERE order_id = %d", $order->order_id);
      if (db_num_rows($result)) {
        $title = t('Ship order !order_id packages.', array(
          '!order_id' => $order->order_id,
        ));
        $actions[] = array(
          'name' => t('Ship'),
          'url' => 'admin/store/orders/' . $order->order_id . '/shipments',
          'icon' => '<img src="' . $module_path . '/images/ship.gif" alt="' . $title . '" />',
          'title' => $title,
        );
      }
    }
  }
  return $actions;
}