Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I keep original customer “sign up” date when converting the account using the Customer API? 
 
cclohman
Sr. Member
 
Avatar
Total Posts:  82
Joined:  2008-06-16
Los Angeles
 

I’m converting an xcart customers list to Magento and would like to preserve their account signup date once they’re on Magento.  In xcart, the field “first_login” has the date I want.  It’s a unix timestamp, which I convert to datetime using the mysql function from_unixtime.  Here’s the code I’m passing to the API:

$newCustomer = array(
    
        
'firstname'  => $cust['firstname'],
    
        
'lastname'   => $cust['lastname'],
    
        
'email'      => $cust['email'],
    
        
'password_hash'   => md5('4g'.'********').':'.'4g',  
    
        
// password hash can be either regular or salted md5:
    
        // $hash = md5($password);
    
        // $hash = md5($salt.$password).':'.$salt;
    
        // both variants are valid
    
        
'created_at'   => $cust['member_since'],

        
'updated_at'   => date('Y-m-d H:i:s'),

        
'store_id'   => 1,
    
        
'website_id' => 1
    
    
);
    
    try 
{
        $customer_id 
$proxy->call($sessionId'customer.create', array($newCustomer));
    
}
    
catch (Exception $e)
    
{
        
echo "Failed to create customer: "$cust['firstname'].' '$cust['lastname']."<br>";
        echo 
"==> Error: ".$e->getMessage();
        echo 
"<br>Script terminated";
        exit;
    
}
    
echo "Successfully created customer: (id) $customer_id (name) {$cust['lastname']}<br>";

As I mentioned, $cust[’member_since’] is a mysql datetime date.  When the customer is created via the API, the “created_at” value that I pass in to the API seems to be ignored and the new account shows up in Magento with a datestamp reflecting the time of import.

Anyone know how to override this?  Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top