[contact-form-7 id="24078" title="Feedback EN"]

Featured templates

osCommerce 2.3. How to edit user menu

This tutorial will show you how to edit header user menu in osCommerce 2.3 templates.

 

Locate menu file

  1. Open your osCommerce installation directory
  2. Go to includes\modules\boxes directory
  3. Open hm_user_menu.php file with your PHP editor

The header user menu is created using the unordered list layout.

      
$data = '<ul class="user_menu">'.
	'<li class="'.$button_act2.'"><a href="' .$acc_link. '">'.tep_draw_button_header_top().'<span>'.$acc_title.'</span>'.tep_draw_button_header_bottom().'</a></li>'.
    
	'<li class="'.$button_act1.'"><a href="'.$login_link.'">'.tep_draw_button_header_top().'<span>'.$login_title.'</span>'.tep_draw_button_header_bottom().'</a></li>'.
         '</ul>';

Each menu button is a list item:

	'<li class="'.$button_act1.'"><a href="'.$login_link.'">'.tep_draw_button_header_top().'<span>'.$login_title.'</span>'.tep_draw_button_header_bottom().'</a></li>'.

 

Edit button titles

As you can see the menu item titles are created using the PHP variables like $acc_title and $login_title. Investigating the includes\modules\boxes\hm_user_menu.php file you can find the variable values:

 $acc_link = tep_href_link('account.php');
$acc_title= MODULE_BOXES_USER_MENU_BOX_MY_ACCOUNT;
} else{ 
$acc_link = tep_href_link('create_account.php');
$acc_title= MODULE_BOXES_USER_MENU_BOX_CREATE_ACCOUNT;
} 
 $login_link = tep_href_link('logoff.php');
$login_title= MODULE_BOXES_USER_MENU_BOX_TITLE_LOGOFF;
} else{ 
$login_link = tep_href_link('login.php');
$login_title= MODULE_BOXES_USER_MENU_BOX_TITLE_LOGIN;
} 

To change the button titles you need to edit the language variables MODULE_BOXES_USER_MENU_BOX_MY_ACCOUNT, MODULE_BOXES_USER_MENU_BOX_CREATE_ACCOUNT etc.

You can modify them in the includes\languages\english\modules\boxes\hm_user_menu.php file

  define('MODULE_BOXES_USER_MENU_TITLE', 'User Menu in Header');
  define('MODULE_BOXES_USER_MENU_DESCRIPTION', 'Show User Menu page links in Header');
  define('MODULE_BOXES_USER_MENU_BOX_TITLE', 'User Menu');
  define('MODULE_BOXES_USER_MENU_BOX_TITLE_LOGIN', 'Log in');
  define('MODULE_BOXES_USER_MENU_BOX_TITLE_LOGOFF', 'Log off');
  define('MODULE_BOXES_USER_MENU_BOX_MY_ACCOUNT', 'My Account');
  define('MODULE_BOXES_USER_MENU_BOX_CREATE_ACCOUNT', 'Create an Account');
  define('MODULE_BOXES_USER_MENU_BOX_SHIPPING', 'Shipping & Returns');

You can modify the variable values or define your own variables.

 

Edit button links

As you can see the menu item links are created using the PHP variables like$acc_link and $login_link. The same way as for the button titles the variable values could be found in includes\modules\boxes\hm_user_menu.php file:

 $acc_link = tep_href_link('account.php');
$acc_title= MODULE_BOXES_USER_MENU_BOX_MY_ACCOUNT;
} else{ 
$acc_link = tep_href_link('create_account.php');
$acc_title= MODULE_BOXES_USER_MENU_BOX_CREATE_ACCOUNT;
} 
 $login_link = tep_href_link('logoff.php');
$login_title= MODULE_BOXES_USER_MENU_BOX_TITLE_LOGOFF;
} else{ 
$login_link = tep_href_link('login.php');
$login_title= MODULE_BOXES_USER_MENU_BOX_TITLE_LOGIN;
} 

You can also see the page filenames the buttons are linked to. 

You can add your variables and add your page using the tutorial on how to add new page to osCommerce store.

 

osCommerce 2.3. How to edit user menu, 1.0 out of 5 based on 2 ratings