让我明确的背景:活跃客户没有在Magento
看那customer_entity
表:
+-----------+----------------+------------------+------------+----------------------+----------+--------------+----------+---------------------+---------------------+-----------+
| entity_id | entity_type_id | attribute_set_id | website_id | email | group_id | increment_id | store_id | created_at | updated_at | is_active |
+-----------+----------------+------------------+------------+----------------------+----------+--------------+----------+---------------------+---------------------+-----------+
| 1 | 1 | 0 | 1 | [email protected] | 1 | 000000001 | 1 | 2007-08-30 23:23:13 | 2008-08-08 12:28:24 | 1 |
| 2 | 1 | 0 | 1 | [email protected] | 1 | | 1 | 2011-08-15 09:51:20 | 2011-09-06 07:31:17 | 0 |
+-----------+----------------+------------------+------------+----------------------+----------+--------------+----------+---------------------+---------------------+-----------+
在客户有ID为2和is_active
属性为0,现在我想更改为1.
$customerId = 2;
$modelCustomer = Mage::getModel('customer/customer')->load($customerId);
$modelCustomer->setIsActive(1);
$modelCustomer->save();
但是,它不起作用。 我该如何解决这个问题或者我错过了什么?
更新:
我可以得到这个客户的好评。
$modelCustomer->getIsActive();//0
调试:
当我发现的日志,我刚看到,我猜对了没有更新is_active
属性:
UPDATE `customer_entity` SET `entity_id` = ?, `entity_type_id` = ?, `attribute_set_id` = ?, `website_id` = ?, `email` = ?, `group_id` = ?, `increment_id` = ?, `store_id` = ?, `created_at` = ?, `updated_at` = ? WHERE (entity_id='2')
是您的请求从上到下执行并且您没有调用任何出口();死();或您的测试之间的类似?机会是你的交易没有执行。 –
@Aton:我不这么认为,因为我没有使用'exit'或'die'功能。而属于'customer_eav_attribute'的其他属性可以正常更新。你能给我另一个解决方案吗?非常感谢。 – vietean
下一步将记录所有查询并查看查询是如何构建的 –