You are here

function uc_order_pane_products in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_order/uc_order.order_pane.inc \uc_order_pane_products()
  2. 7.3 uc_order/uc_order.order_pane.inc \uc_order_pane_products()

Handle the "Products" order pane.

1 string reference to 'uc_order_pane_products'
uc_order_order_pane in uc_order/uc_order.module
Implementation of hook_order_pane().

File

uc_order/uc_order_order_pane.inc, line 267
This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.

Code

function uc_order_pane_products($op, $arg1) {
  switch ($op) {
    case 'view':
      return tapir_get_table('op_products_view_table', $arg1->products);
    case 'customer':
      return tapir_get_table('op_products_customer_table', $arg1->products);
    case 'edit-theme':
      uc_add_js('uc_order_load_product_edit_div(' . $arg1['order_id']['#value'] . ');', 'inline');
      $output = '<div id="products-selector"></div>' . '<div id="products-container">' . t('Loading product information... (<em>If nothing happens, make sure you have Javascript enabled.</em>)') . '</div>';
      return $output;
    case 'edit-title':
      $settings = array(
        'div' => '#products-selector',
        'class' => 'product-select-box',
        'vid' => variable_get('uc_catalog_vid', 0),
        'filter' => implode(',', module_invoke_all('product_types')),
        'search' => 'true',
        'nids' => 'true',
        'close' => 'true',
        'nodesg' => 'product',
        'nodepl' => 'products',
        'select' => 'add_product_form();',
      );
      if (module_exists('ubrowser') && module_exists('uc_catalog') && variable_get('uc_ubrowser_product_select', TRUE)) {
        $output = ubrowser_button(t('Add product'), $settings, NULL, 'add-product-button') . ' ';
      }
      else {
        $output = '<input type="button" value="' . t('Add product') . '" onclick="load_product_select(' . $arg1['order_id']['#value'] . ', false);" id="add-product-button" />';
      }
      $output .= '<input type="button" value="' . t('Add blank line') . '" onclick="add_blank_line_button(' . $arg1['order_id']['#value'] . ');" />';
      $output .= ' <span id="product-div-throbber"></span>';
      return $output;
  }
}