Post by Reptile » Fri Jul 28, 2017 8:06 pm

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?

All my extensions: Click here or Click here


User avatar
Active Member

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by daniGo » Sat Jul 29, 2017 12:05 am

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.

http://www.gombac.si


Active Member

Posts

Joined
Wed Mar 20, 2013 4:49 pm
Location - Slovenia

Post by Reptile » Sat Jul 29, 2017 6:20 am

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 ?

All my extensions: Click here or Click here


User avatar
Active Member

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by opencartboost » Sat Jul 29, 2017 12:33 pm

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

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by Reptile » Sat Jul 29, 2017 4:38 pm

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?

All my extensions: Click here or Click here


User avatar
Active Member

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by skip » Sat Sep 16, 2017 5:46 am

Yes just add in language, works for me
example:

Code: Select all

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

Active Member

Posts

Joined
Mon May 09, 2011 9:57 pm

Post by Brio-go » 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

Newbie

Posts

Joined
Sun Sep 10, 2017 3:24 pm

Post by Qphoria » Sun Sep 17, 2017 2:51 am

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.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by joshbxx@gmail.com » Tue Sep 17, 2019 6:36 am

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.


Posts

Joined
Thu Aug 15, 2019 9:03 am
Who is online

Users browsing this forum: Amazon [Bot], jrr and 28 guests