I have a data-install script that I'd like to update each customer with a new custom id. I'm restricting the update to 2 customer groups, so I'm fetching the customers like so:
$customers = Mage::getModel('customer/customer')->getCollection() ->addFieldToFilter('group_id', array('in' => array('5', '11'))); This returns over 6000 customers. I then loop over the customers, add two new attributes and save:
$myIncrementalValue = 0; foreach($customers as $customer) { $myIncrementalValue++; $customer->setData('myincrementalvalue', $myIncrementalValue) ->setData('special_code', 'OL-' . $customer->getId() . '-' . $myIncrementalValue) ->save(); } This is very taxing on my server and the script always fatals due to wait timeouts. Can anyone tell me a cheaper way of executing mass custom updates on customers.