2016-08-30 173 views
1

我使用prestashop的多商店选项。我想在第二家店通过客户注册后进行手动激活。多商店,prestashop手动激活帐户

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

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

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

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

+0

什么是prestashop版本? – JazZ

回答

1

在的Prestashop 1.6

你可以得到id_shopContext对象。

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

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

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

希望它能帮助。

编辑

更新的答案,从场景中获得id_shop,因为直到它增加了客户对象不处理它。

重新编辑

Customer类(/classes/Customer.php)定制add()功能。

添加此行绕线212(以下简称“last_passwd_gen”的宣言后):

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

但你最好的解决方案是创建功能的override

+0

感谢您的帮助,我使用prestashop 1.6.1.2但它不起作用 我知道从数据库中的id_shop 我添加在controllers/front/AuthController.php if(Context :: getContext() - > shop- > id == 3){ $ customer-> active = 0; }其他{ $ customer-> active = 1; } 但注册后客户仍然在这两个网站不活跃 –

+0

不客气。我重新编辑答案。要自定义的文件是'classes/Customer.php'。祝你好运。 – JazZ

+0

非常感谢,最后的解决方案正常工作:)) –