Jump to content

[solved well sort of] Back Office Module Needs customer language for proper email language


El Patron

Recommended Posts

I want to simply set the customers language so proper email is used, this is initiated by action in the back office.  the customer object language is for some bloody reason protected so no joy.

 

context->language is used for both employee (back office) an customer in front office...so I can't get it that way...

 

I do not see a way to get the customers language for proper email without accessing their customer information from db..which I had hoped to avoid but will if need be.

 

any tips?

 

Thanks, brain dead el

Link to comment
Share on other sites

what a boon doogle...

 

ps did not start capturing the customers language until 1.5.4.1, good idea if not like years late to the party

 

no wonder so many issues with customer communications in wrong language.

 

here is my hack:

	$this->cust_lang = self::_getCustomerLang();

	private function _getCustomerLang()
	{
		if (substr(_PS_VERSION_, 0, 7) >= '1.5.4.1') 		 {
			$sql = 'SELECT `id_lang`
					FROM `'._DB_PREFIX_.'customer`
					WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'AND `id_customer` = '.$this->context->customer->id.'';
			$result = Db::getInstance()->getRow($sql);
			return $result['id_lang'];
		}else{
			return $result = (int)(Configuration::get('PS_LANG_DEFAULT'));
		}
	}

I'm tired. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...