Magento customer

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)是无用的,因为它永远都是真的 – 

分析参考:
https://magento.stackexchange.com/questions/116677/how-to-know-if-magegetmodelcustomer-customer-load-succeeded

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用 * 标注