Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
add random customers to Magento database
//PHP array containing forenames.
$names = array(
//PHP array containing surnames.
$surnames = array(
$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
for($i=0; $i<30; $i++) {
//Generate a random forename.
$random_name = $names[mt_rand(0, sizeof($names) - 1)];
//Generate a random surname.
$random_surname = $surnames[mt_rand(0, sizeof($surnames) - 1)];
echo "Adding user: ";
echo $random_name . ' ' . $random_surname;
echo "<br>";
$customer = Mage::getModel("customer/customer");
$customer ->setWebsiteId($websiteId)
catch (Exception $e) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment