Post by stzm » Tue Feb 28, 2012 2:33 am

As there is no option to create a custom menu link on opencart i have use the following code to insert a custom link on my main menu.

Code: Select all

    <li><a href="http://myshop.com/my-custom-page">Custom English Button</a></li>

I want to know how to change the language on the "Custom English Button" automatically as the other pages. So when the non-English page loads to change the language of the button text too.


thanks in advance i hope this to help others

SOLUTION

THE FILES WE HAVE TO EDIT:

1. header.tpl on /catalog/view/theme/yourthemefolder/template/common
2. header.php on /catalog/language/english and /catalog/language/yourlanguage (you going to edit 2 files for 2 languages)
3. header.php on /catalog/controller/common

THE CODE WE HAVE TO WRITE:

on the 1. you just create the following:

Code: Select all

     <li><a href="http://byzantiumicons.com/saints-index"><?php echo $new_linktext; ?></a></li>


on the 2. the languages files we doing the following:

Code: Select all

$_['new_linktext'] = 'Your English Text';
For a different language we just go to the language folder and we add the same as the above just with the none-nglish lanauge text.

3. Finally here we create the following:

$this->data['new_linktext'] = $this->language->get('new_linktext');

just write it below: $this->data['text_home'] = $this->language->get('text_home');

Thats it.

Newbie

Posts

Joined
Tue Feb 28, 2012 2:27 am
Who is online

Users browsing this forum: No registered users and 83 guests