Take the 2-minute tour ×

I've tried asking this on Opencart forums (thread link), but still can't quite get it, though someone tried to explain this to me. I hope someone here can help.

I've written some extensions before where I have a custom function in the controller called from view , for example: if I edit admin/controller/sale/customer.php and after index() function add

public function foo(){
//code here

I can access it by using


Now I have a module in catalog, could I access a function in it's controller from view, in the below example "foo"?


class ControllerModuleMyModule extends Controller {
   protected function index($setting) {
public function foo(){

Basically, I want to make an AJAX call to it from whatever page/route the module is on. Many thanks in advance.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This can be done in the same way you would for any module. For instance, if you'd added foo() to /catalog/controller/module/cart.php you would use


There's nothing special about the module controllers compared with any other accessible module

share|improve this answer
You are right,it works. I don't know what threw me off to start with. Must've been over-thinking it.Thanks a lot! –  B-and-P Nov 29 '12 at 4:23

Your Answer


