Select cust by name not email | new backend orders

  • Posts: 15
  • Thank you received: 0
  • Hikashop Business
12 years 2 months ago #62365

When using backend order creation, my client would prefer to select the customer by name rather than email from the dropdown field provided. I've narrowed the file(s) that need to be modified (I think) to order/user.php, but am unsure of the changes that need to be made. Please advise!

Thanks for your help!
Gary Marsh

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 2 months ago #62411

Hi gmarsh,

You have to edit the file \administrator\components\com_hikashop\types\user.php and replace your load function by:

	function load($value){
		$this->values = array();
		$query = 'SELECT user_id, user_cms_id, user_email FROM '.hikashop_table('user');
		$db =& JFactory::getDBO();
		$db->setQuery($query);
		$users = $db->loadObjectList('user_id');

		$query = 'SELECT * FROM '.hikashop_table('users',false).' ';
		$db->setQuery($query);
		$usersCms = $db->loadObjectList();

		if(!empty($users)){
			foreach($users as $user){
				foreach($usersCms as $userCms){
					if($userCms->id == $user->user_cms_id)
						$this->values[] = JHTML::_('select.option', (int)$user->user_id, $user->user_id . ' ' .$userCms->username );
				}
			}
		}
	}

The following user(s) said Thank You: gmarsh

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0
  • Hikashop Business
12 years 2 months ago #62465

That worked beautifully! Thank you so much for your quick and comprehensive response.
Gary Marsh

Please Log in or Create an account to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum