【问题标题】:multi store, manual activation account with prestashop多商店,使用 prestashop 手动激活帐户
【发布时间】:2017-01-06 22:56:10
【问题描述】:

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

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

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

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

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

【问题讨论】:

  • prestashop 版本是什么?

标签: prestashop account manual activation multistore


【解决方案1】:

在 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,因为 Customer 对象在添加之前不会处理它。

重新编辑

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

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

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

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

【讨论】:

  • 感谢您的帮助,我使用 prestashop 1.6.1.2 但它不起作用我知道我在 controllers/front/AuthController.php 中添加的数据库中的 id_shop if (Context::getContext() ->shop->id == 3) { $customer->active = 0; } 其他 { $customer->active = 1; } 但注册后客户在两个网站上仍然不活跃
  • 不客气。我重新编辑答案。要自定义的文件是classes/Customer.php。祝你好运。
猜你喜欢
  • 1970-01-01
  • 2015-10-16
  • 2015-12-04
  • 1970-01-01
  • 2016-03-11
  • 1970-01-01
  • 2019-03-17
  • 2011-01-02
  • 2017-08-19
相关资源
最近更新 更多