1

我使用 prestashop 的多商店选项。我想在注册后将第二家商店的客户传递给手动激活。

实际上我$customer->active = 0;在 authentication.php 中设置。

两个网站上的所有注册客户在注册后都处于非活动状态。

有没有办法$customer->active = 0;只为一个网站设置。

我想得到,shop_id但我不知道如何发展我的想法。

4

1 回答 1

1

在 Prestashop 1.6中:

您可以id_shop使用Context对象获取 。

所以,我认为你可以做这样的事情:

如果你知道id_shop(假设id_shop= 1)

if (Context::getContext()->shop->id == 1) {
    $customer->active = 0;
} else {
    $customer->active = 1;
}

希望能帮助到你。

编辑

更新了获取id_shopfrom 上下文的答案,因为 Customer 对象在添加之前不会处理它。

重新编辑

Customer类(/classes/Customer.php)中自定义add()函数。

在第 212 行周围添加这一行(在“last_passwd_gen”声明之后):

$this->active = ($this->id_shop == 3) ? false : true;

但对您来说最好的解决方案是创建函数的覆盖

于 2016-08-30T15:41:48.377 回答