Post by DesignCart » 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

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? :)

my website: Tworzenie sklepu internetowego Opencart


User avatar
New member

Posts

Joined
Thu Nov 10, 2016 2:06 pm
Location - Gubin

Post by kestas » Wed Oct 10, 2018 1:55 pm

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

Custom OpenCart modules and solutions. Just PM me... Extensions you can find here and here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by DesignCart » Wed Oct 10, 2018 2:05 pm

I'm sorry it is mistake but only in my post.
In code names of modules are coretly.

my website: Tworzenie sklepu internetowego Opencart


User avatar
New member

Posts

Joined
Thu Nov 10, 2016 2:06 pm
Location - Gubin

Post by DesignCart » Wed Oct 10, 2018 5:28 pm

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
??? :-\

my website: Tworzenie sklepu internetowego Opencart


User avatar
New member

Posts

Joined
Thu Nov 10, 2016 2:06 pm
Location - Gubin

Post by kestas » Wed Oct 10, 2018 5:50 pm

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

Custom OpenCart modules and solutions. Just PM me... Extensions you can find here and here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by DesignCart » 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

my website: Tworzenie sklepu internetowego Opencart


User avatar
New member

Posts

Joined
Thu Nov 10, 2016 2:06 pm
Location - Gubin

Post by kestas » Wed Oct 10, 2018 8:43 pm

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....

Custom OpenCart modules and solutions. Just PM me... Extensions you can find here and here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by Qphoria » Thu Oct 11, 2018 5:14 am

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.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by DesignCart » Thu Oct 11, 2018 3:11 pm

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?

my website: Tworzenie sklepu internetowego Opencart


User avatar
New member

Posts

Joined
Thu Nov 10, 2016 2:06 pm
Location - Gubin
Who is online

Users browsing this forum: No registered users and 21 guests