$this->config->get('something') in opencart

user4541912 picture user4541912 · Feb 9, 2015 · Viewed 9.7k times · Source

I am newbie in opencart as well as in php. I am discovering opencart templates, I found $this->config->get this line, I am a little bit confused about this. I don't understand clearly. This request we are using this object (current) access config object and call get method of config object, am I right ?
I have read that get query data from database. This data is set from admin panel.

So here are questions :
1. Where can I find config object declaration
2. Get uses simple query to retrieve data from database ?
3. How can I add my own fields, I mean how can I add some fields in admin panel, for instance in category configuration to use them in this way $this->config->get.

I would be grateful for any help.

Answer

shadyyx picture shadyyx · Feb 9, 2015
  1. <OC_ROOT>/system/library/config.php
  2. What do you mean by simple query? if SELECT <COLUMN[S]> FROM <TABLE> WHERE <CONDITION[S]> is simple for you, then yes
  3. Too broad for answering here. Check the code for how the administration settings are handled, or settings from certain extensions/modules and You'll see. Basically if you insert some new rows into the setting table and provide a unique key for that setting you can retrieve it by calling $this->config->get('<KEY>');.