Page 1 of 1

Text variables. Where are they?

Posted: Fri Jul 28, 2017 8:06 pm
by Reptile
I was wondering how does opencart load the text variables?
Comparing the setting.php for example in Opencart 2 you have these entries:

Code: Select all

$data['text_edit'] = $this->language->get('text_edit');
		$data['text_enabled'] = $this->language->get('text_enabled');
		$data['text_disabled'] = $this->language->get('text_disabled');
		$data['text_select'] = $this->language->get('text_select');
But when looking in the same setting.php file in Opencart 3.x I can't seem to find any of these entries but language is loaded.
How is this done in Opencart 3?

Re: Text variables. Where are they?

Posted: Sat Jul 29, 2017 12:05 am
by daniGo
All language value are loaded with events:

admin/controller/event/language.php
catalog/controller/event/language.php

only those which need sprintf and mails are loaded in controllers.

Re: Text variables. Where are they?

Posted: Sat Jul 29, 2017 6:20 am
by Reptile
Ok thank you.
How would one add an extra custom language variable the correct way?
Just as previously directly in the controller?
Or is there a different way in OC3 ?

Re: Text variables. Where are they?

Posted: Sat Jul 29, 2017 12:33 pm
by opencartboost
Point 8
Language data is all implicitly loaded now when load->language is called. No more redundant $text_xxx = $this->language->get('text_xxx');
viewtopic.php?f=2&t=185176

Re: Text variables. Where are they?

Posted: Sat Jul 29, 2017 4:38 pm
by Reptile
Thank you did not see this forum post with changes yet.
So no need to add these language entries in the controller anymore if I understand correctly?

They just need to be in the language files only?

Re: Text variables. Where are they?

Posted: Sat Sep 16, 2017 5:46 am
by skip
Yes just add in language, works for me
example:

Code: Select all

$_['text_location']           = 'Some-text';

Re: Text variables. Where are they?

Posted: Sat Sep 16, 2017 1:14 pm
by Brio-go
Like I had a crash with the program error.
Or do I have to remove the reinstall?


gclub

Re: Text variables. Where are they?

Posted: Sun Sep 17, 2017 2:51 am
by Qphoria
Brio-go wrote:
Sat Sep 16, 2017 1:14 pm
Like I had a crash with the program error.
Or do I have to remove the reinstall?


gclub
php scripts cannot "crash". Are you saying you made a change to the language file and it shows an error? Just undo your change and try again.
Show us the line you are trying to add.

Re: Text variables. Where are they?

Posted: Tue Sep 17, 2019 6:36 am
by joshbxx@gmail.com
Having an issue after trying to install an extension for modifying attributes. (extension did not work btw). Now everywhere in the back end admin area titles atre preceded by "text_" , and tab_" ie : tab_general, tab_data, tab_links etc... aslo changed my statuses to text enabled. Is there a fix for this? I have already uninstalled the extension and tried to restore my files.