siios Posted May 2, 2017 Share Posted May 2, 2017 Hola! estoy empezando con prestashop, he creado un modulo y todo funciona correctamente y se muestra en pantalla al pulsar mi tab, pero no consigo hacer que mi formulario pase por el postprocess() del FrontController al hacer el submit, pleaseee alguien que me ayudeee!! archivo prueba/prueba.php: public function install() { Configuration::updateValue('PRUEBA_LIVE_MODE', false); return parent::install() && $this->registerHook('header') && $this->registerHook('backOfficeHeader') && $this->registerHook('displayHomeTab') && $this->registerHook('displayHomeTabContent'); } public function hookDisplayHomeTabContent() { global $smarty; $this->context->controller->addCSS($this->_path.'/views/css/prueba_content.css'); $this->context->controller->addJS($this->_path.'/views/js/prueba.js'); $this->smarty->assign(array( 'mess'=>''))); return $this->display(__FILE__,'prueba_content.tpl'); } archivo prueba/views/templates/front/prueba_content.tpl: <form action="{l s=$link->getModuleLink('prueba', 'pruebafrontcontroller')|escape:'html'}" method="post"> {if ($mess!="")} <h4 class="title_block"> {*l s=$mess mod='prueba'*} {$mess} </h4> {/if} <input type="submit" name="submit_requestform" value="Submit" /> </form> archivo prueba/controllers/front/pruebafrontcontroller.php: class PruebaFrontController extends ModuleFrontController { private $mess = ''; //public $php_self = 'prueba'; //public $ssl = true; public function postProcess() { if (Tools::isSubmit('submit_requestform')) { $this->message = 'FORMULARIO CORRECTO'; $this->context->smarty->assign('mess', $this->message); } } public function initContent() { parent::initContent(); $this->message = 'por fiiiiin!'; $this->context->smarty->assign('mess', $this->message); $this->setTemplate('prueba_content.tpl'); } } Gracias!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now