Page 1 of 1

Load module model

Posted: Wed Oct 10, 2018 12:34 pm
by DesignCart
Hi
I have controller in catalog/controller/extension/module/dc_modulename.php
and I have model in catalog/model/extension/module/dc_modulename.php

Model has name ModelExtensionModuleDcModulename

when I try load model in controller by this code

Code: Select all

$this->load->model('extension/module/dc_modulename');
...I get error

Warning: Invalid argument supplied for foreach() in vqmod/vqcache/vq2-system_engine_loader.php on line 83

when I try load model by this code

Code: Select all

$this->load->model('extension/module/dc_modulename');
...I get this error

Fatal error: Uncaught Exception: Error: Could not load model module/dc_modylename! in
vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php:89 Stack trace: #0 catalog\controller\extension\module\dc_modulename.php(6): Loader->model('module/dc_newsl...') #1
storage_modification_system_engine_action.php(79): ControllerExtensionModuleDcModulename->index(Array) #2 vqmod\vqcache\vq2-storage_modification_system_engine_loader.php(48): Action->execute(Object(Registry), Array) #3 catalog\controller\common\super_bottom.php(63): Loader->controller('extension/modul...', Array) #4
vqmod\vqcache\vq2-storage_modification_system_engine_action.php(79): ControllerCommonSuperBottom->index(Array) #5
vqmod\vqcache\vq2-torage_modification_system_engine_loader.php(48): vqmod\vqcache\vq2-
storage_modification_system_engine_loader.php on line 89

Somebode tell me how coretly load module model? :)

Re: Load module model

Posted: Wed Oct 10, 2018 1:55 pm
by kestas
Fatal error: Uncaught Exception: Error: Could not load model module/dc_modylename!
check this in red there is your mistake... should be
dc_modulename
instead
dc_modylename
Cheers

Re: Load module model

Posted: Wed Oct 10, 2018 2:05 pm
by DesignCart
I'm sorry it is mistake but only in my post.
In code names of modules are coretly.

Re: Load module model

Posted: Wed Oct 10, 2018 5:28 pm
by DesignCart
Somebody have any idea?
Hov load a model from catalog/model/extension/module/dc_modulename.php
in controller catalog/controller/extension/module/dc_modulename.php
??? :-\

Re: Load module model

Posted: Wed Oct 10, 2018 5:50 pm
by kestas
Fatal error: Uncaught Exception: Error: Could not load model module/dc_modylename! in
vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php:89 Stack trace: #0 catalog\controller\extension\module\dc_modulename.php(6): Loader->model('module/dc_newsl...') #1
storage_modification_system_engine_action.php(79): ControllerExtensionModuleDcModulename->index(Array) #2 vqmod\vqcache\vq2-storage_modification_system_engine_loader.php(48): Action->execute(Object(Registry), Array) #3 catalog\controller\common\super_bottom.php(63): Loader->controller('extension/modul...', Array) #4
vqmod\vqcache\vq2-storage_modification_system_engine_action.php(79): ControllerCommonSuperBottom->index(Array) #5
vqmod\vqcache\vq2-torage_modification_system_engine_loader.php(48): vqmod\vqcache\vq2-
storage_modification_system_engine_loader.php on line 89

this error shows that model file with name dc_modylename.php does not exist

Re: Load module model

Posted: Wed Oct 10, 2018 5:55 pm
by DesignCart
Yes, but when I was pasting an error into the post, I changed the name of the module. So don't look at this module name. I paste agein errors:

Code: Select all

Fatal error: Uncaught Exception: Error: Could not load model module/ds_modulename! in \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php:89 Stack trace: #0 \catalog\controller\extension\module\ds_modulename.php(6): Loader->model('module/dc_newsl...') #1 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_action.php(79): ControllerExtensionModuleDcNewsletter->index(Array) #2 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php(48): Action->execute(Object(Registry), Array) #3 \catalog\controller\common\super_bottom.php(63): Loader->controller('extension/modul...', Array) #4 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_action.php(79): ControllerCommonSuperBottom->index(Array) #5 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php(48): Action in \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php on line 89

Re: Load module model

Posted: Wed Oct 10, 2018 8:43 pm
by kestas
DesignCart wrote:
Wed Oct 10, 2018 5:55 pm
Yes, but when I was pasting an error into the post, I changed the name of the module. So don't look at this module name. I paste agein errors:

Code: Select all

Fatal error: Uncaught Exception: Error: Could not load model module/ds_modulename! in \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php:89 Stack trace: #0 \catalog\controller\extension\module\ds_modulename.php(6): Loader->model('module/dc_newsl...') #1 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_action.php(79): ControllerExtensionModuleDcNewsletter->index(Array) #2 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php(48): Action->execute(Object(Registry), Array) #3 \catalog\controller\common\super_bottom.php(63): Loader->controller('extension/modul...', Array) #4 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_action.php(79): ControllerCommonSuperBottom->index(Array) #5 \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php(48): Action in \vqmod\vqcache\vq2-C:_xampp7_storage_modification_system_engine_loader.php on line 89

Anyway this error show that file should be: catalog/model/module/ds_modulename.php
so seems you trying to loud it incorrectly in your controller file.
if your code to load model file is

Code: Select all

$this->load->model('extension/module/dc_modulename');
and file does not exist error will be:
Fatal error: Uncaught Exception: Error: Could not load model extension/module/ds_modulename! in \vqmod\vqcache\vq2-...........
regarding posted error you trying load file like:

Code: Select all

$this->load->model('module/dc_modulename');
you need carefully check your code and after you made some changes do not forget to clear cache in your admin dashboard and refresh modifications....

Re: Load module model

Posted: Thu Oct 11, 2018 5:14 am
by Qphoria
DesignCart wrote:
Wed Oct 10, 2018 12:34 pm
Hi
I have controller in catalog/controller/extension/module/dc_modulename.php
and I have model in catalog/model/extension/module/dc_modulename.php

Model has name ModelExtensionModuleDcModulename

when I try load model in controller by this code

Code: Select all

$this->load->model('extension/module/dc_modulename');
...I get error

Warning: Invalid argument supplied for foreach() in vqmod/vqcache/vq2-system_engine_loader.php on line 83
That first code is correct. The error comes because your model file has no methods inside of it. The model loader tries to get all of the callable methods within that model file using

Code: Select all

foreach (get_class_methods($class) as $method) { 
but it's likely empty.
Add at least a dummy function.

Re: Load module model

Posted: Thu Oct 11, 2018 3:11 pm
by DesignCart
Qphoria the model class is not empty. It has example, tested method . Maybe problem is in class name. So I have two files that work together.

First controller:
path: catalog/controller/extension/module/dc_modulename.php
class name: ControllerExtensionModuleDcModulename

in this file I try load model by code:

Code: Select all

$this->load->model('module/dc_modulename');
This attempt displays errors.

My model file is in catalog/model/extension/module/dc_modulename.php

I paste code from this file:

Code: Select all

<?php
class ModelExtensionModuleDcModulename extends Model{
		public function ItWork(){
			echo "It's work!!!";
		}
}
?>
Somebody see something wrong in this names and code?