我正在编写一个脚本,自动导入用户到magento。下面是一个代码片段:
$customer = Mage::getModel("customer/customer");
$customer->website_id = $websiteId;
$customer->setStore($store);
$customer->loadByEmail($riga[10]);
echo "Importo ".$data[0]."\n";
echo " email :".$data[10]."\n";
$customer->setTaxvat($data[7]);
$customer->lastname = $lastname;
$customer->email = $data[10];
$customer->password_hash = md5($data[0]);
$customer->save();问题是用户被创建为“未确认”,而我希望他们被“确认”。
我尝试过:
$customer->setConfirmation('1');在保存之前,但它不起作用。有人知道如何确认用户吗?
谢谢!
发布于 2010-08-06 03:56:22
我想setConfirmation()正在等待确认密钥。尝试传递null,我想它会起作用?
只是想澄清一下:
$customer->save();
$customer->setConfirmation(null);
$customer->save();应该强制确认。
发布于 2012-01-20 19:43:49
当我创建帐户时,它们已经被确认了,但它们被禁用了!这就解决了这个问题:
$customer->save();
$customer->setConfirmation(null);
$customer->setStatus(1);
$customer->save();发布于 2015-12-15 16:34:51
保存整个模型的成本很高。您只能保存非常快速的确认属性:
$customer->setConfirmation(NULL);
$customer->getResource()->saveAttribute($customer, 'confirmation');https://stackoverflow.com/questions/3417049
复制相似问题