hmm ok look at it maybe you will see problem because i don't have a clue what is wrong.
OrderOPCController.php - here iam calling exec of my new actionhook –> hookactionbeforesummary
protected function _assignPayment()
{
if ((bool)Configuration::get('PS_ADVANCED_PAYMENT_API')) {
$this->context->smarty->assign(array(
'HOOK_TOP_PAYMENT' => ($this->isLogged ? Hook::exec('displayPaymentTop') : ''),
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
'HOOK_ADVANCED_PAYMENT' => Hook::exec('advancedPaymentOptions', array(), null, true),
'link_conditions' => $this->link_conditions
));
} else {
$this->context->smarty->assign(array(
'HOOK_TOP_PAYMENT' => ($this->isLogged ? Hook::exec('displayPaymentTop') : ''),
'HOOK_PAYMENT' => $this->_getPaymentMethods()
));
}
Hook::exec('hookactionbeforesummary',array());
}
And my modul php file.
public function install()
{
if (!parent::install()
.
.
.
|| !$this->registerHook('displayGdprOrder')
|| !$this->registerHook('actionbeforesummary')) {
return false;
}
}
public function hookdisplayGdprOrder($params)
{
$this->smarty->assign('heureka_message', $this->l('checkbox text'));
return $this->display(__FILE__, 'orderprocess.tpl', $this->getCacheId());
}
public function hookactionbeforesummary($params)
{
if(Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
if (Tools::getValue('heureka_checkbox') == '1') {
$data = array(
'id_cart' => $params['cart']->id,
'id_customer' => $params['cart']->id_customer,
'value' => $suhlas,
);
Db::getInstance()->insert('heureka_suhlas', $data);
}
}
}
orderprocessheureka.tpl file which is hooked to hookdisplayGdprOrder and this hook is showed under checkbox for terms and conditions .
<div class="error_customerprivacy" style="color:red;"></div>
<fieldset class="account_creation heureka">
<div style="width:21px; float:left;">
<div class="required checkbox">
<input type="checkbox" value="1" id="heureka_checkbox" name="heureka_checkbox" autocomplete="off"/>
</div>
</div>
<div style="width: 92%; float: left; margin-top: 8px;">
<label for="customer_privacy" style="font-weight: normal;">{$heureka_message}</label>
</div>
</fieldset>