简体   繁体   中英

opencart extension install display form options

I have install function inside my controller but I can't figure out how to display a form.

My install method is pretty complex and I want to give the user a couple of options before installing.

Edit : try to make this question more clear by rewriting my question and providing some code due to close: "unclear what you're asking".

Question

How can I display a form (standard HTML form with options) to the user before they install my extension? So they click "install" and get shown a form with options before it actually handles the install.

Code:

public function install(){
    // custom code

    $this->template = 'module/extension_name/install.tpl';
    $this->response->setOutput($this->render());
}

The problem here with the installation of extensions is that 80% of extensions does not have install method - the installation is done via parent class. If the extension has install and uninstall methods, they are called during this parent install process, but they are supposed only to CREATE / DROP tables or perform other DB changes needed by the extension.

In this case it is not very good idea to inject the default install process with some options You want to give to the user. Instead of this, You can make Your extension editable and give users the form to set the default settings within this extensions details.

I have done this the very same way in my photo gallery extension: after You click on edit, You can set the default settings in the top area while You can then create/edit/delete photo galleries in the area below...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM