Php Prestashop模块付款挂钩未触发
Prestashop 1.6.1.6需要在支付挂钩中进行一些API调用。但是由于某些原因,钩子没有被触发,钩子付款方法也没有执行。当与Paypal模块相比较,Paypal模块也有hookPayment,那么这个hook就被执行了。我做错了什么 模块代码尽可能简单Php Prestashop模块付款挂钩未触发,php,module,prestashop,payment,prestashop-1.6,Php,Module,Prestashop,Payment,Prestashop 1.6,Prestashop 1.6.1.6需要在支付挂钩中进行一些API调用。但是由于某些原因,钩子没有被触发,钩子付款方法也没有执行。当与Paypal模块相比较,Paypal模块也有hookPayment,那么这个hook就被执行了。我做错了什么 模块代码尽可能简单 <?php if (!defined('_PS_VERSION_')) exit; class TestModule extends Module { public function __construct(
<?php
if (!defined('_PS_VERSION_'))
exit;
class TestModule extends Module
{
public function __construct()
{
$this->name = 'testmodule';
$this->tab = 'shipping_logistics';
$this->version = '1.0.0';
$this->author = 'Firstname Lastname';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Test Module');
$this->description = $this->l('Description of my module.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
}
public function install()
{
if (!parent::install() || !$this->registerHook('payment'))
return false;
return true;
}
public function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
public function hookPayment($params)
{
ddd($params);
}
}
您在函数名中键入了一个错误,它说
公共函数hoolPayment($params)
,但应该是公共函数hookPayment($params)
您在函数名中键入了一个错误,它说公共函数hoolPayment($params)
,但应该是公共函数hookPayment($params)
在安装过程中,PrestaShop模块需要扩展PaymentModule以触发付款挂钩。仅更改扩展或重置没有帮助。在安装过程中,PrestaShop模块需要扩展PaymentModule才能触发付款挂钩。只是更改扩展或重置都没有帮助。回答得很好!修正了输入错误并重置了模块,但仍然没有。我以前也玩过,没有输入错误。你怎么检查它是否进入钩子?(您是将其记录到文件中,还是只是执行die())ddd($params);在paypal中,模块打印成吨的可变值。在我的测试模块中,它不会打印任何东西。你确定没有任何其他模块挂在这个awell上,在你的模块之前就死了吗?你可以在你的后端验证(转到模块->职位->搜索付款)。是的,我确定。我在进一步研究和阅读代码后找到了答案。我也发帖子给其他人看。回答得很好!修正了输入错误并重置了模块,但仍然没有。我以前也玩过,没有输入错误。你怎么检查它是否进入钩子?(您是将其记录到文件中,还是只是执行die())ddd($params);在paypal中,模块打印成吨的可变值。在我的测试模块中,它不会打印任何东西。你确定没有任何其他模块挂在这个awell上,在你的模块之前就死了吗?你可以在你的后端验证(转到模块->职位->搜索付款)。是的,我确定。我在进一步研究和阅读代码后找到了答案。我也发帖子给别人看。
mysql> select * from module where id_module=75;
+-----------+------------+--------+---------+
| id_module | name | active | version |
+-----------+------------+--------+---------+
| 75 | testmodule | 1 | 1.0.0 |
+-----------+------------+--------+---------+
1 row in set (0,00 sec)
mysql> select * from hook_module where id_module=75;
+-----------+---------+---------+----------+
| id_module | id_shop | id_hook | position |
+-----------+---------+---------+----------+
| 75 | 1 | 1 | 4 |
+-----------+---------+---------+----------+
1 row in set (0,00 sec)
mysql> select * from hook where id_hook=1;
+---------+----------------+---------+-----------------------------------------------------+----------+-----------+
| id_hook | name | title | description | position | live_edit |
+---------+----------------+---------+-----------------------------------------------------+----------+-----------+
| 1 | displayPayment | Payment | This hook displays new elements on the payment page | 1 | 1 |
+---------+----------------+---------+-----------------------------------------------------+----------+-----------+
1 row in set (0,00 sec)