Post by fyg50 » Wed Feb 07, 2018 9:30 am

Hello friends,
I am developing a plugin for Opencart, in fact the plugin is over.
I'm just having trouble adding multi-language support
I can update the plugin database without needing it
I have problems with adding update text to multi-language input

Module related screen display admin/store/setting

Image

The steps and codes I implement are as follows:

1) admin/view/template/setting/setting.tpl

Code: Select all

<div class="form-group required">
            <label class="col-sm-2 control-label">Module test</label>
            <div class="col-sm-10">
              <?php foreach ($languages as $language) { ?>
              <div class="input-group"><span class="input-group-addon"><img src="language/<?php echo $language

['code']; ?>/<?php echo $language['code']; ?>.png" title="<?php echo $language['name']; ?>" /></span>
                <textarea name="config_fatih_test[<?php echo $language['language_id']; ?>]" cols="40" 

rows="5"><?php echo isset($config_fatih_test[$language['language_id']]) ? $config_fatih_test[$language

['language_id']] : ''; ?></textarea>
              </div>
              
              <?php } ?>
            </div>
          </div>
2) admin/controller/setting/setting.php

Code: Select all

$this->load->model('localisation/language');
        $data['languages'] = $this->model_localisation_language->getLanguages();
        
        
        if (isset($this->request->post['config_fatih_test'])) {
            $data['config_fatih_test'] = $this->request->post['config_fatih_test'];
        } else {
            $data['config_fatih_test'] = $this->config->get('config_fatih_test');
        }
The product page I want to reflect on the front side
3) catalog/controller/product/product.php

Code: Select all

$this->load->model('localisation/language');
        $data['languages'] = $this->model_localisation_language->getLanguages();
        
        $data['config_fatih_test'] = $this->config->get('config_fatih_test');
        
4) catalog/view/theme/default/template/product/product.tpl
The codes I tried to project a few types;

Code: Select all

<?php echo $config_fatih_test[$language['language_id']]; ?>
<?php echo $config_fatih_test; ?>
My codes are as above
The problem I am experiencing is: Only this code on the product page worked <?php echo $config_fatih_test[$language['language_id']]; ?>

But when I change the language of the site, it does not change with the text on the dock,
fixed text remains, can you help in this?

Regards

Newbie

Posts

Joined
Wed Dec 13, 2017 12:47 am

Post by fyg50 » Wed Feb 14, 2018 5:49 pm

Problem solved

3) catalog/controller/product/product.php 
FILE;

Code: Select all

$this->load->model('localisation/language');
        $data['languages'] = $this->model_localisation_language->getLanguages();
        
        $data['config_fatih_test'] = $this->config->get('config_fatih_test');

Replaced with the following code:

Code: Select all

$test = $this->config->get('config_fatih_test');
$data['config_fatih_test] = $test[$this->config->get('config_language_id')];


Newbie

Posts

Joined
Wed Dec 13, 2017 12:47 am
Who is online

Users browsing this forum: No registered users and 5 guests