I am writing 2 modules, one dependent on the other and both extend the user profile page. The first one is order_history
and the other one order_details
. The concept is order_history
pulls out a list of all orders and order_details
displays only 1 order but with details.
Now the problems are:
- I am able to access
http://localhost/drupal/user/1/order_history
and I get the table. But when I click on the link, I am taken tohttp://localhost/drupal/user/1/1001
. - When I directly put the url
http://localhost/drupal/user/1/order_history/1001
, I see the order_history table but not the message.
Can't figure out what's wrong with the code. Please point to the right direction.
So here is the code for both:
order_history.module
function order_history_menu(){
$items = array();
$items['user/%user/order_history'] = array(
'title' => 'Order History',
'page callback' => 'drupal_get_form',
'page arguments' => array('order_history_form'),
'access arguments' => array('access order history'),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
function order_history_form($form) {
$output_form='<div class="form-wrapper">
<table style="width:100%;">
<thead>
<tr>
<th>Order Number</th>
<th>Order Date</th>
<th>Order Status</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="1001">1001</a>
</td>
<td>2014-04-01</td>
<td>Shipped by seller</td>
<td>$468.89</td>
</tr>
</tbody>
</table>
</div>';
$form['order_history'] = array(
'#type' => 'markup',
'#title' => t('Order History'),
'#markup' => drupal_render($output_form),
);
return $form;
}
order_details.module :
function order_details_menu(){
$items = array();
$items['user/%user/order_history/%order_number'] = array(
'title' => 'Order Details',
'page callback' => 'order_details',
'page arguments' => array('%user','%order_number'),
'access arguments' => array('access order details'),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
function order_details($user, $order_number){
drupal_set_message('Response from order details.');
}