Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save herveguetin/300ead7f03e88f5ab6b9 to your computer and use it in GitHub Desktop.
Save herveguetin/300ead7f03e88f5ab6b9 to your computer and use it in GitHub Desktop.
Affect all Magento customers to a group
<?php
$customerGroupId = SOME_CUSTOMER_GROUP_ID;
$table = Mage::getModel('customer/customer')->getResource()
->getWriteConnection()
->getTable('customer/entity');
$query = "UPDATE {$table} SET group_id = {$customerGroupId} WHERE group_id != {$customerGroupId}";
$conn->query($query);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment