skip to Main Content

I’m trying to develop an Opencart4 Extension and for some reason it’s throwing a 404 when I try to access it.

I’ve the following structure:

/opencart/extensions/myextension/admin/controller/payment/myextension.php
/opencart/extensions/myextension/admin/template/payment/myextension.twig

and here’s the controller:

<?PHP

namespace OpencartAdminControllerExtensionMyExtensionPayment;

class MyExtension extends OpencartSystemEngineController {

   public function index() {

        $data = array();

        $data['header'] = $this->load->controller('common/header');
        $data['column_left'] = $this->load->controller('common/column_left');
        $data['footer'] = $this->load->controller('common/footer');

        $this->response->setOutput($this->load->view('extension/myextension/payment/myextension', $data));
   }
}

Now when I try to access the http://localhost/admin123/index.php?route=extension/myextension/payment/myextension, I get a 404 page!

Screenshot

2

Answers


  1. template must be twig file:

    /opencart/extensions/myextension/admin/template/payment/myextension.twig
    
    Login or Signup to reply.
  2. that works extension in opencart 4, before need compile your extension to

    myextension.ocmod.zip

    and then install from admin, then should works.

    this is correct structure.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search