答案 0 :(得分:0)
以下是我在项目中的表现。它不是一个干净的选择,但它正如期望的那样工作。
在order-carrier.tpl
的顶部,我添加了一个钩子:
{hook h="checkCustomForm"}
我创建了一个模块/mdoules/customform/customform.php
<?php
if (!defined('_PS_VERSION_'))
exit;
class CustomForm extends Module
{
public function __construct()
{
$this->name = 'customform';
$this->tab = 'administration';
$this->version = '1.0.0';
$this->author = 'Florian Lemaitre';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Custom Form');
$this->description = $this->l('Custom Form');
}
public function install()
{
return $this->createTable()
&& parent::install()
&& $this->registerHook('checkCustomForm');
}
public function hookcheckCustomForm($params)
{
[process your form values here (Tools::getValue('my_value') ...)]
if (error)
{
// We redirect to the Adrress page with a flag 'missing_value' to alert an error
Tools::redirect('index.php?controller=order&step=1&missing_value=true');
}
}
}