0){ $firstname = $data[0]; $lastname = $data[1]; $email = $data[2]; $passwd = Tools::passwdGen(8); if($data[3] == "male"){ $civility = 1; } else{ $civility = 2; } $date = explode('/', $data[4]); $date_anniv = $date[2] .'-'.$date[1].'-'.$date[0]; $test_email = new Customer(); $test_email->getByEmail($email); if(empty($test_email->id)){ $customer = new Customer(); $customer->firstname = $firstname; $customer->lastname = $lastname; $customer->email = $email; $customer->passwd = $passwd; $customer->id_gender = $civility; $customer->birthday = $date_anniv; $customer->newsletter = 1; $customer->add(); if(isset($customer->id)){ echo Mail::Send( '2', 'account', Mail::l('Welcome!'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => $passwd ), $customer->email, $customer->firstname.' '.$customer->lastname ); echo $customer->email; } } } $row++; echo " row :".$row."
"; ob_end_flush(); flush(); ob_start(); } fclose($handle); echo "Import terminé"; }else{ echo "prob ouverture"; } function utf8EncodeArray($array){ return (is_array($array) ? array_map('utf8_encode', $array) : utf8_encode($array)); } // function registerGuest($email, $active = true){ // $id_shop = Context::getContext()->shop->id; // $id_shop_group = Context::getContext()->shop->id_shop_group; // $sql = 'INSERT INTO '._DB_PREFIX_.'newsletter (id_shop, id_shop_group, email, newsletter_date_add, active) // VALUES // ('.$id_shop.', // '.$id_shop_group.', // \''.pSQL($email).'\', // NOW(), // '.(int)$active.' // )'; // return Db::getInstance()->execute($sql); // }