A
A
Alex Goncharov2018-10-10 13:29:44
opencart
Alex Goncharov, 2018-10-10 13:29:44

How to work with language variables in OpenCart ocStore?

Colleagues, tell me, please. I'm trying to add a language variable.
Procedure:
1. Added translation to the language file in header.php in the ru-ru folder

$_['preim1head']          = 'Заголовок преимущества 1';
$_['preim1desc']          = 'Описание преимущества 1';

2. Added output in header.php controller
// Benefits
$data['preim1head'] = $this->language->get('preim1head');
    $data['preim1desc'] = $this->language->get('preim1desc');

3. I display it in header.tpl 4. I update the cache in add-ons. At the output in the desired block, I get the name of the variable, and not the text specified in the language file. CHADNT?
<h4><?php echo $preim1head; ?></h4>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Goncharov, 2018-10-10
@calirails

Don't forget to switch the language when editing files! And update the cache. This guide works!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question