Page 1 of 1

Listing manufacturers

Posted: Sun Jun 12, 2016 3:26 am
by KillerDuck
Hey All,

I've started creating my first module and wanted to know if it's possible to call information from other controllers/models than the one being worked on.

For example, displaying a list of manufacturers. I was going to create a model/controller/, call up manufacturers from db, assign to an array, echo output.

Can I include product/manufacturers model to get information?

(a working example would be appreciated)
Thanks

Re: Listing manufacturers

Posted: Sun Jun 12, 2016 11:20 am
by fido-x
KillerDuck wrote:Can I include product/manufacturers model to get information?
The manufacture model can be loaded with:

Code: Select all

$this->load->model('catalog/manufacturer');
Once the model is loaded, you can access any function from the model. For example, to get a list of manufacturers, you would use:

Code: Select all

$manufacturers = $this->model_catalog_manufacturer->getManufacturers();
This would load all manufacturers into an array called $manufacturers. You can then manipulate the data how you want.

Re: Listing manufacturers

Posted: Thu Jun 23, 2016 4:41 pm
by KillerDuck
Thanks for the info, worked perfectly!

Finally getting to grips with it now so really appreciated, thanks :D