You are here

function hook_uc_order_actions in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_order/uc_order.api.php \hook_uc_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).
1 function implements hook_uc_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_shipping_uc_order_actions in shipping/uc_shipping/uc_shipping.module
Implements hook_uc_order_actions().
1 invocation of hook_uc_order_actions()
uc_order_actions in uc_order/uc_order.module
Returns the actions a user may perform on an order.

File

uc_order/uc_order.api.php, line 208
Hooks provided by the Order module.

Code

function hook_uc_order_actions($order) {
  $actions = array();
  if (user_access('fulfill orders')) {
    $result = db_query("SELECT COUNT(nid) FROM {uc_order_products} WHERE order_id = :id AND data LIKE :data", array(
      ':id' => $order->order_id,
      ':data' => '%s:9:\\"shippable\\";s:1:\\"1\\";%',
    ));
    if ($result
      ->fetchField()) {
      $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' => theme('image', array(
          'path' => drupal_get_path('module', 'uc_shipping') . '/images/package.gif',
        )),
        'title' => $title,
      );
      $result = db_query("SELECT COUNT(package_id) FROM {uc_packages} WHERE order_id = :id", array(
        ':id' => $order->order_id,
      ));
      if ($result
        ->fetchField()) {
        $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' => theme('image', array(
            'path' => drupal_get_path('module', 'uc_shipping') . '/images/ship.gif',
          )),
          'title' => $title,
        );
      }
    }
  }
  return $actions;
}