AbanteCart Development > API Development

how to load model from other controller?

(1/3) > >>

huyhoang08:
i need to load model from other controller? help me?

yonghan:
Hi, I suggest you to read abantecart core codes both on storefront and admin so you can understand better about calling model etc. You can just use $this->load->model('existing_model'); from your controller.

abantecart:

--- Quote from: huyhoang08 on March 15, 2016, 03:54:22 AM ---i need to load model from other controller? help me?

--- End quote ---

To load model, you need to include it with below code and you can access methods:
See examples with 'sale/order' model in admin.


--- Code: ---$this->loadModel('sale/order');
$orders =  $this->model_sale_order->getOrders();

--- End code ---

or with generic loader class

--- Code: ---$this->load->model('sale/order');
$orders =  $this->model_sale_order->getOrders();

--- End code ---



huyhoang08:
First sory for my english skill.
I cleared about that, But for example:
i have 2 extension activated:
Sory, i mean from one extension i able to load a model belong to other extension?

yonghan:
You can do that, it's the same as what abantecart says. As long as you know which model that you want to access and use.

Navigation

[0] Message Index

[#] Next page

Go to full version
Powered by SMFPacks Social Login Mod