我使用prestashop的多商店选项 . 我希望在注册后将第二家商店的客户转移到手动激活 .
实际上我在authentication.php中设置了 $customer->active = 0; .
$customer->active = 0;
注册后,两个网站的所有注册客户均无效 .
有没有办法为一个网站设置 $customer->active = 0; .
我想得到 shop_id 但我不知道如何发展我的想法 .
shop_id
在Prestashop 1.6 :
您可以使用Context对象获取 id_shop .
id_shop
所以,我认为你可以这样做:
如果你知道 id_shop (假设 id_shop = 1)
if (Context::getContext()->shop->id == 1) { $customer->active = 0; } else { $customer->active = 1; }
希望能帮助到你 .
EDIT
更新了从上下文获取 id_shop 的答案,因为客户对象未添加't handle it until it' .
RE-EDIT
在 Customer 类(/classes/Customer.php)中自定义 add() 函数 .
Customer
add()
在第212行附近添加此行(在“last_passwd_gen”声明之后):
$this->active = ($this->id_shop == 3) ? false : true;
但最适合您的解决方案是创建函数的override .
1 回答
在Prestashop 1.6 :
您可以使用Context对象获取
id_shop
.所以,我认为你可以这样做:
如果你知道
id_shop
(假设id_shop
= 1)希望能帮助到你 .
EDIT
更新了从上下文获取
id_shop
的答案,因为客户对象未添加't handle it until it' .RE-EDIT
在
Customer
类(/classes/Customer.php)中自定义add()
函数 .在第212行附近添加此行(在“last_passwd_gen”声明之后):
但最适合您的解决方案是创建函数的override .