Post by strgg » Fri Oct 21, 2016 6:26 pm

I have a php file which is placed within the Opencart root (2.0.1.1).

I want to add a new language with the OC methods.

According to admin/index.php and model || controller/localisation/language.php i shall adjust

Code: Select all

require_once($root . 'admin/config.php'); 
require_once($root . 'system/startup.php');
// Registry
$registry = new Registry();
// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
// Config
$config = new Config();
$registry->set('config', $config);
// Database
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PORT);
$registry->set('db', $db);
// Settings
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'");
foreach ($query->rows as $setting) {
if (!$setting['serialized']) {
$config->set($setting['key'], $setting['value']);
} else {
$config->set($setting['key'], json_decode($setting['value'], true));
}
}
//STARTING NOW, $langu instead of $this
$data = array("name"=>"slovak","code"=>"sk","lokal"=>"sk-SK",..);
$langu = new Language();
$langu->load->model('localisation/language');
$langu->model_localisation_language->addLanguage($data);
this doesn't work. it results in
Notice: Use of undefined constant DB_PORT - assumed 'DB_PORT' in /path/opencart/admin/controller/module/_account22/account22_getLangZipUnzip.php on line 21

Notice: Undefined property: Language::$load in /path/opencart/admin/controller/module/_account22/account22_getLangZipUnzip.php on line 108

Fatal error: Call to a member function language() on a non-object in /path/opencart/admin/controller/module/_account22/account22_getLangZipUnzip.php on line 108
Fatal Error is at $langu->load->model('localisation/language');

Newbie

Posts

Joined
Wed Feb 04, 2015 7:51 pm
Who is online

Users browsing this forum: No registered users and 3 guests