Post by tom8943 » Fri Oct 23, 2020 8:08 pm

I want to make "open" field in Opencart 3 store setting multilingual.

In the admin\view\template\setting\setting.twig. I have found these lines:

<div class="form-group">
<label class="col-sm-2 control-label" for="input-open"><span data-toggle="tooltip" data-container="#tab-general" title="{{ help_open }}"> {{ entry_open }}</span></label>
<div class="col-sm-10">
<textarea name="config_open" rows="5" placeholder="{{ entry_open }}" id="input-open" class="form-control">{{ config_open }}</textarea>
</div>
</div>
I have made from textarea - input and add {% for language in languages %}, language flags, and language ID.

{% for language in languages %}
<div class="form-group">
<label class="col-sm-2 control-label" for="input-open{{ language.language_id }}"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /><span data-toggle="tooltip" data-container="#tab-general" title="{{ help_open }}"> {{ entry_open }}</span></label>
<div class="col-sm-10">
<input type="text" name="config_open[{{ language.language_id }}][title]" placeholder="{{ entry_open }}" id="input-open{{ language.language_id }}" value="{{ config_open[language.language_id] ? config_open[language.language_id].title }}" class="form-control" />
</div>
</div>
{% endfor %}
After this, in the store settings, I have "open" field in the two languages. And the information in these fields is now stored.

In the front end controller, I have made this.

$data['open'] = nl2br($this->config->get('config_open'));
When was one language all is work but now I have an error:

Warning: nl2br() expects parameter 1 to be string, array given in /var/www/fastuser/data/www/localstite.loc/storage/modification/catalog/controller/common/header.php on line 81
php

mcdvoice


Newbie

Posts

Joined
Fri Oct 23, 2020 8:05 pm

Post by thekrotek » Sat Oct 24, 2020 4:19 am

Error says for itself.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am

Who is online

Users browsing this forum: No registered users and 4 guests