多商店,使用 prestashop 手动激活帐户

multi store, manual activation account with prestashop

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

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

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

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

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

在 Prestashop 中 1.6 :

你可以用 Context 对象得到 id_shop

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

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

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

希望对您有所帮助。

编辑

更新了从上下文中获取 id_shop 的答案,因为客户对象在添加之前不会处理它。

重新编辑

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

在第 212 行周围添加此行(在 "last_passwd_gen" 声明之后):

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

但对您来说最好的解决方案是创建一个 override 函数。