How to load Model outside Controller in OpenCart
It is only one method that you need to copy, you would be best adding a method to the Cart class itself. The Cart class will work with the
$this->db->query()
calls as it already has $db
assigned to it even though it is not a Controller/Model.
In this post we have share load Model outside Controller in OpenCart.Should you wish to do this, you could do something similar to the following:
model('catalog/product'); $model = $registry->get('model_catalog_product'); $result = $model->getProduct(333); } ?>