FaLang translation of custom order statuses

  • Posts: 43
  • Thank you received: 0
9 years 2 months ago #214932

-- HikaShop version -- : 2.5.0
-- HikaMarket version -- : 1.6.5
-- Joomla version -- : 3.4.4

Hi,

I'm having an issue with translation of custom order statuses with HikaMarket. I've had feedback from Faboba saying that the issue may be on the HikaShop end how the list is compiled (as a query). All order statuses correctly translated, but custom order statuses don't appear right.

Ideas?

Thanks,
David

Last edit: 9 years 2 months ago by Jerome. Reason: remove private content

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #214951

Hi,

HikaMarket use HikaShop to get the list of the order statuses.
In the view "ordermarket | status", it use the type "order_status".
That type load the statuses from the database with the translations

	protected function load() {
		$categoryClass = hikamarket::get('shop.class.category');
		$filters = array();
		$rows = $categoryClass->loadAllWithTrans('status', false, $filters);

		foreach($rows as $row) {
			if(!empty($row->translation)) {
				$this->values[] = JHTML::_('select.option', $row->category_name, hikamarket::orderStatus($row->translation));
			} else {
				$this->values[] = JHTML::_('select.option', $row->category_name, hikamarket::orderStatus($row->category_name));
			}
		}
	}
If the order status does not have any translation in Falang (or Joomfish), HikaMarket will use the Joomla translation system to translate them.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 43
  • Thank you received: 0
9 years 1 month ago #215045

HI,

It doesn't add up. Displaying, changing, and saving order statuses behaves differently for.
1 Vendor front-end.
2 Administrator back-end in list view.
2 Administrator back-end in specific order view.

It seams that the definition in the language file is used in the first instance, which then becomes properly translated for standard order statuses that are defined in the language file, and secondly the base non-translated definition from HikaShop > System > Order statuses for other order statuses.

There is also a difference between what the drop-down displays and what value is actually saved.

Regards,

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #215084

Hi,

Please provide details and examples.
Something concrete which can be understand and analyze.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 43
  • Thank you received: 0
9 years 1 month ago #215220

Hi,

All order statuses translated with FaLang. Img 1.

1. Vendor front-end changing order status mixes languages. Img 2. Looks to be a mix of system language for default order statuses and FaLang non-translated language for non-default order statuses.

2. Admiinstrator back-end order list view displays correct order statuses in drop-down (img 3) and saves in correct language when selected (img 4). However, if the order status was non-default, the non-translated order status is specified in order view (img 5).

3. Administrator back-end order view displays correct order statuses in drop-down (img 6), but reverts to non-translated value when the order is saved if a non-default order status is selected (img 7).

Hope that explains.

Regards,
David

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #215228

Hi,

Looks like the function "loadAllWithTrans" is using the User default language stored in his profile.
So in the HikaShop category class you can replace:

	$user = JFactory::getUser();
	$locale = $user->getParam('language');
	if(empty($locale)){
		$config = JFactory::getConfig();
		if(!HIKASHOP_J16){
			$locale = $config->getValue('config.language');
		} else {
			$locale = $config->get('language');
			if($locale === null)
				$locale = $config->get('config.language');
		}
	}
By
	if(empty($locale)) {
		$user = JFactory::getUser();
		$locale = $user->getParam('language');
	}
	if(empty($locale)){
		$config = JFactory::getConfig();
		if(!HIKASHOP_J16){
			$locale = $config->getValue('config.language');
		} else {
			$locale = $config->get('language');
			if($locale === null)
				$locale = $config->get('config.language');
		}
	}
And change the definition of the function to add a new parameter
function loadAllWithTrans($type = '', $all = false, $filters = array(), $order = ' ORDER BY category_ordering ASC', $start = 0, $value = 500, $category_image = false, $locale = null) {

The, in HikaMarket, you have to give the current locale to the function
	$rows = $categoryClass->loadAllWithTrans('status', false, $filters);
By
	$locale = null;
	$app = JFactory::getApplication();
	if(!$app->isAdmin()) {
		$lang = JFactory::getLanguage();
		$locale = $lang->getTag();
	}
	$rows = $categoryClass->loadAllWithTrans('status', false, $filters, ' ORDER BY category_ordering ASC', 0, 500, false, $locale);
And it should logically fix the issue.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Moderators: Obsidev
Time to create page: 0.067 seconds
Powered by Kunena Forum