magento 获取用户数据信息
$customer = Mage::getModel('customer/customer')->load($params['customer_id']);
//$customer = Mage::getModel('customer/customer')->load(12345);
if ($customer->getId()) {
// This is an existing customer
} else {
// This is not an existing customer
}
用load()
的Mage::getModel('customer/customer')
。因此,Mage_Customer_Model_Customer
即使没有具有该ID的客户,他也总是会得到一个对象。这就是加载方法的工作原理。添加if ($customer)
是无用的,因为它永远都是真的 –