1
votes

I have to use following code for display current language code. So, It is working fine in older version. but, it is not work in latest OpenCart version.

Code:

<?php echo $_SESSION['language']; ?>

I got error:

PHP Notice: Undefined index: language in C:\xampplite\htdocs\2.2.0.0\catalog\view\theme\default\template\common\header.tpl on line 58

1
If you want to display language code in opencart than you can used <?php echo $lang; ?> in your header file.hardik solanki
I have already try this. but, it is not work. actually, I have use is code in jquery code. $(document).ready(function() { $("#filter_name").autocomplete("getdata.php?lan=<?php echo $_SESSION['language']; ?>", { width: 260 }); });HDP

1 Answers

1
votes

You can simply do

<?php echo $lang; ?>

inside your header.tpl.

OR

In the common/header.php controller, there is a line.

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

You can echo it to get the language code.