So this was pretty easy and it's a great function.
1.) lets create a button
1.A) /includes/languages/english/YOUR_TEMPLATE_NAME/button_names.php
add:
PHP Code:
define('BUTTON_RMA_REQUEST', 'button_rma_request.png'); <-- Name of your button
define('BUTTON_RMA_REQUEST_ALT', 'Request an RMA'); <-- You buttons ALT (alternative text)
1.b) upload your button
/includes/templates/YOUR_TEMPLATE_NAME/buttons/english
2. lets add the button to the My Account > History > Order Info page
2.A) /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_account_history_info_default.php
I added my button at the end of the file right after the <br class="clearBoth" /> and closing </div>
PHP Code:
<div class="rmaRequestButton"><?php echo '<a href="' . zen_href_link(FILENAME_RETURNS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">' . zen_image_button(BUTTON_RMA_REQUEST) . '</a>'; ?></div>
3.) /includes/modules/pages/returns/header_php.php
find:
PHP Code:
if (REGISTERED_RETURN == 'true'){
if (!$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
}
right below that add:
PHP Code:
if (!isset($_GET['order_id']) || (isset($_GET['order_id']) && !is_numeric($_GET['order_id']))) {
zen_redirect(zen_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
}
towards the bottom find:
PHP Code:
$city = $check_customer->fields['entry_city'];
right below that add:
PHP Code:
$customer_info_query = "SELECT customers_id
FROM " . TABLE_ORDERS . "
WHERE orders_id = :ordersID";
$customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_GET['order_id'], 'integer');
$customer_info = $db->Execute($customer_info_query);
$order_number = $_GET['order_id'];
Thats it, now your customers "Order Number" text field on the returns page will be pre-populated by the order_id from within the My Account > History > Order Info page
Enjoy!