Hi there,
Maybe I'm approaching this the wrong way, but I'm writting a custom model to do some ajax validation of the user
login and password and can't seem to access the ControllerAccountLogin class rrom my new model.
I've used another frameworks before and for example in codeigniter I could create an instance of the core object doing something like $CI =& get_instance();. That way the newly created variable would have access to all of the core classes and functions.
Meaning I could do something like $CI->ControllerID->functionID
I'm just struggling to use the current user validation from within my custom model.
Is something similar available here?
Maybe I'm approaching this the wrong way, but I'm writting a custom model to do some ajax validation of the user
login and password and can't seem to access the ControllerAccountLogin class rrom my new model.
I've used another frameworks before and for example in codeigniter I could create an instance of the core object doing something like $CI =& get_instance();. That way the newly created variable would have access to all of the core classes and functions.
Meaning I could do something like $CI->ControllerID->functionID
I'm just struggling to use the current user validation from within my custom model.
Is something similar available here?
Models don't call controllers. Controllers load models and call to them.
When in the controller, you can use $this->class->function from controllers to load any library class or and loaded model function.
Registered Library Examples:
$this->currency->format()
$this->cart->getSubTotal()
$this->customer->getCustomerGroupId()
etc
Model Examples:
$this->load->model('catalog/product');
$this->model_catalog_product->getProducts();
$this->load->model('account/address');
$this->model_account_address->getAddress();
When in the controller, you can use $this->class->function from controllers to load any library class or and loaded model function.
Registered Library Examples:
$this->currency->format()
$this->cart->getSubTotal()
$this->customer->getCustomerGroupId()
etc
Model Examples:
$this->load->model('catalog/product');
$this->model_catalog_product->getProducts();
$this->load->model('account/address');
$this->model_account_address->getAddress();
so in short you need to write a controller too not just a model.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Hi Q,
I just attempted to clone the Free Shipping mod so I could offer an 'Expedited Free Shipping' version as well. I followed your instructions on how to clone a mod but am getting an error saying:
Fatal Error: 'Class Controllershippingsxpedite' not found in 'my path../system/engine/home.php'.
I basically replaced all instances of 'free' with 'expedite' in all 5 'free' files but feels as though I need to register a new class or change the way it uses the Free Shipping Class?
Thanks in advance for any advice.
I just attempted to clone the Free Shipping mod so I could offer an 'Expedited Free Shipping' version as well. I followed your instructions on how to clone a mod but am getting an error saying:
Fatal Error: 'Class Controllershippingsxpedite' not found in 'my path../system/engine/home.php'.
I basically replaced all instances of 'free' with 'expedite' in all 5 'free' files but feels as though I need to register a new class or change the way it uses the Free Shipping Class?
Thanks in advance for any advice.
Hi Q,
sorry, that was just my typo when I posted the error.
The actual error in the code was that I hadn't repeated the case sensitive word change in admin/controller shipping/expedite.php of: ControllerShippingExpedite
& in catalog/model/shippipng/expedite.php of: ModelShippingExpedite
That done it all seems to work swimmingly
Many thanks for another great tutorial!
sorry, that was just my typo when I posted the error.
The actual error in the code was that I hadn't repeated the case sensitive word change in admin/controller shipping/expedite.php of: ControllerShippingExpedite
& in catalog/model/shippipng/expedite.php of: ModelShippingExpedite
That done it all seems to work swimmingly

Many thanks for another great tutorial!
Who is online
Users browsing this forum: No registered users and 10 guests