Jump to content

Updating language text via hook


petem

Recommended Posts

Hi,

I am looking for a way to update the language text of "cartexistingdomainchoice" via a hook.  I need the text to be different for one particular product but cannot find a way to change that text via a hook.  Any ideas?

Thanks

Pete

Link to comment
Share on other sites

Hi Pete,

24 minutes ago, petem said:

I am looking for a way to update the language text of "cartexistingdomainchoice" via a hook.

i'm tempted to say it would be as easy to do in the template as it's only a Smarty IF statement around the language output...

26 minutes ago, petem said:

I need the text to be different for one particular product but cannot find a way to change that text via a hook.  Any ideas?

basically you declare the language array globally; check if it's product x being configured and if so, modify the specific language string in the array and then return that modified array to the template.

<?php

# Translate Specific Language String Hook
# Written by brian!

function translate_specific_string_hook($vars) {
	
	global $_LANG;
	if ($vars['templatefile'] == "configureproductdomain" && $vars['pid'] == 45) {
		$_LANG['cartexistingdomainchoice'] = "To Be Or Not To Be";
		return array("LANG" => $_LANG);
	}
}
add_hook("ClientAreaPageCart", 1, "translate_specific_string_hook");

so in the above example, 45 is the PID value when this string is going to be changed to the specified string in the hook - that string can be hard-coded in one language (everyone will see that string as is), or if your site is multilingual, you could use Language Overrides - which would be Lang::trans('**language_override_string**)... but if memory serves, your site is English only, so if that's the case,  hardcoding the string should be sufficient for your needs.

t64QrXy.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated