Page 1 of 1

[SOLVED] multiple model load

Posted: Tue Jun 03, 2025 10:45 am
by Joe1234
In going through some modified files I notice some functions have multiple model loads of the same file in the same function. Does opencart disregard secondary loads of the same include file, or are the files actually being loaded multiple times? What's the best way to address this? I have what I call a "general fix" ocmod for my setup, where I include simple one liner things that I need rectified throughout opencart, I was thinking of deleting the commenting out the insertion of that load logic in the ocmods and then inserting one call to load that model in my "general fix" so it works for all the ocmods that need it. Any better solutions? Or is this just not needed?

Re: multiple model load

Posted: Tue Jun 03, 2025 6:11 pm
by paulfeakins
Joe1234 wrote:
Tue Jun 03, 2025 10:45 am
In going through some modified files I notice some functions have multiple model loads of the same file in the same function.
Give us an example.

Re: multiple model load

Posted: Tue Jun 03, 2025 6:18 pm
by JNeuhoff
It only uses one model instance, even when you call the $this->load->model(....) multiple times for the same route.
See the system/engine/loader.php.

Re: multiple model load

Posted: Wed Jun 04, 2025 3:57 pm
by Joe1234
Thanks