大家好,感谢您花时间阅读我的帖子。
我对 Prestashop 很陌生。我从 Prestashop 插件中添加了条纹定期支付模块。它运作良好。
但我的目标是根据他在模块功能中订阅的产品的 id 将用户添加到一个组中,addStripeSubscription()
就像开发人员建议的那样。我无法读取错误,因为模块仅返回服务器错误,因此我无法获得更多信息。
这是我实际在做的事情:
$customer = new customer(6); //This is my customer id
if ($id_product == 27) {
// On ajoute l'user au groupe champion
$new_id_group = 4; // This is an existing group's id
if ($customer->id_default_group!=$new_id_group) {
$customer->cleanGroups();
$customer->addGroups([(int)$new_id_group]);
$customer->id_default_group = (int)$new_id_group;
$customer->update(); // It fails here
}
}
// if ($id_product == 28) {
// // Groupe chevalier
// $new_id_group = 5;
// if ($customer->id_default_group!=$new_id_group) {
// $customer->cleanGroups();
// $customer->addGroups(array((int)$new_id_group));
// $customer->id_default_group = (int)$new_id_group;
// $customer->update();
// }
// }
它失败了,$customer->update();
但前提$customer->addGroups($new_id_group)
是没有评论。所以它与这个addGroups()
功能有关。即使我直接在addGroups()
函数参数中传递 3(Prestashop 中的默认客户组),它也会失败。
这真让我抓狂。
为什么会这样?我错过了什么?
谢谢你的帮助 !