Welcome Guest, Not a member yet? Register   Sign In
Loading a model in another model

OK, I'm assuming you can do this but I can't get it to work.

I have Model_a that gets product information.
I have Model_b that gets shipping information.

I want to call a function from model_b into model_a

When I do something like this...
$options = $this->Model_b->get_shipping_options();
I get this error message "Fatal error: Call to a member function get_shipping_options() on a non-object ."

Any ideas?
I've tried auto-loading the module(s) but that didn't help.

I know I'm calling the models correctly because I can do it from the controller.

Also, I had a real issue getting the db connection working in my models... I had to set a variable as the db connection in the constructor.

Any help would be great.

$CI =& get_instance();
echo $CI-model_b->some_function();

Theme © iAndrew 2016 - Forum software by © MyBB