Can someone tell me how I can add another item on the Orders page to the existing 'Secondary Local Tasks' which is currently two buttons :- 'Apply Pricing Rules' and 'Simulate Checkout Completion'.

I am overriding page--admin--commerce--orders.tpl.php and would like to add a button to the $secondary_local_tasks variable but can't find where it's set. It's not a menu and isn't in template.php. Any ideas?


Just emulate what you see in the other modules:

  if (module_exists('commerce_order_ui')) {
    $items['admin/commerce/orders/%commerce_order/edit/refresh'] = array(
      'title' => 'Apply pricing rules',
      'description' => 'Executes the cart order refresh used to apply all current pricing rules on the front end.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('commerce_cart_order_refresh_form', 3),
      'access callback' => 'commerce_cart_order_refresh_form_access',
      'access arguments' => array(3),
      'type' => MENU_LOCAL_ACTION,
      'file' => 'includes/commerce_cart.admin.inc',

The important thing is the type and the path.

  • Thanks again for your response. In the end I added the code I needed to this template page--admin--commerce--orders.tpl.php after figuring out the order_id etc from the $variables variable. – OnCreative Mar 17 '16 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.