function generateColors($seed, $_amount) { $arr = array(); $next = $seed; for ($i = 0; $i < $_amount; $i++) { $next = hexdec(substr(md5($next), 0, 8)); array_push($arr, createColors($next)); } return $arr; }
require __DIR__ . '/../core/bootstrap.php'; $thelia = new Thelia\Core\Thelia("dev", true); $thelia->boot(); $faker = Faker\Factory::create(); // Intialize URL management $url = new Thelia\Tools\URL(); $con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $con->beginTransaction(); try { $stmt = $con->prepare("SET foreign_key_checks = 0"); $stmt->execute(); clearTables($con); $stmt = $con->prepare("SET foreign_key_checks = 1"); $stmt->execute(); $material = createMaterials($con); $color = createColors($con); $brands = createBrands($faker, $con); $folders = createFolders($faker, $con); $contents = createContents($faker, $folders, $con); $categories = createCategories($faker, $con); echo "creating templates\n"; $template = new \Thelia\Model\Template(); $template->setLocale('fr_FR')->setName('template de démo')->setLocale('en_US')->setName('demo template')->save($con); $at = new Thelia\Model\AttributeTemplate(); $at->setTemplate($template)->setAttribute($color)->save($con); $ft = new Thelia\Model\FeatureTemplate(); $ft->setTemplate($template)->setFeature($material)->save($con); echo "end creating templates\n"; createProduct($faker, $categories, $brands, $contents, $template, $color, $material, $con); createCustomer($faker, $con); // set some config key