Jump to content

Show all Language Fields in Admin to save time


shopimport.nl

Recommended Posts

I'm almost able to implement solution to show all languages for fields which require multiple languages.

 

I just need some jquery trick, so who is able to help me and I hope others who like this.

 

My shop has 6 languages. I have MANY clicks due to language switching and no overview. I want to show all language fields and not to click on the flag then select the language. I also don't see upfront the language text so I have to cycle trhough all the languages for each field.

 

What I did so far.

 

in js/admin.js I modified a line to change hide() into show(). This will keep the input visible. Then I added a line to show the flag. However here I get always the same flag and I need to show the corresponding flag. This should be based on the id="lang_4" .

 

I changed:

.siblings('div:not(.displayed_flag):not(.clear)').hide()

into

.siblings('div:not(.displayed_flag):not(.clear)').show()

 

and added:

 

.siblings('div:not(.displayed_flag):not(.clear)').append('<span><img src="../img/l/' + id_language_new + '.jpg"/></span>')
$('.language_current').attr('src', '../img/l/' + id_language_new + '.jpg');

 

The complete function with these changes included:

 

function changeFormLanguage(id_language_new, iso_code, employee_cookie)
{
$('.translatable').each(function() {
$(this).find('.lang_' + id_language_new)
.show()
.siblings('div:not(.displayed_flag):not(.clear)').show()
 .siblings('div:not(.displayed_flag):not(.clear)').append('<span><img src="../img/l/' + id_language_new + '.jpg"/></span>')
$('.language_current').attr('src', '../img/l/' + id_language_new + '.jpg');
});
$('.language_flags').hide();
if (employee_cookie)
$.post("ajax.php", { form_language_id: id_language_new });
id_language = id_language_new;
updateFriendlyURL();
updateCurrentText();
}

 

By the way, this is only working in products and categories as other forms are still using the old changeLanguage() function. But it's a start!

 

I would really appreciate if somebody can let me know how to change id_language_new and to get the correct language then this will help me further.

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...