Implemented "Remember Me" feature on admin. Started template management
This commit is contained in:
@@ -240,6 +240,28 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
$template = new Thelia\Model\Template();
|
||||
setI18n($faker, $template, array("Name" => 20));
|
||||
$template->save();
|
||||
|
||||
foreach($attributeList as $attributeId => $attributeAvId) {
|
||||
$at = new Thelia\Model\AttributeTemplate();
|
||||
|
||||
$at
|
||||
->setTemplate($template)
|
||||
->setAttributeId($attributeId)
|
||||
->save();
|
||||
}
|
||||
|
||||
foreach($featureList as $featureId => $featureAvId) {
|
||||
$ft = new Thelia\Model\FeatureTemplate();
|
||||
|
||||
$ft
|
||||
->setTemplate($template)
|
||||
->setFeatureId($featureId)
|
||||
->save();
|
||||
}
|
||||
|
||||
//folders and contents
|
||||
$contentIdList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
@@ -296,12 +318,12 @@ try {
|
||||
$subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList, $contentIdList);
|
||||
|
||||
for($k=0; $k<rand(0, 5); $k++) {
|
||||
createProduct($faker, $subcategory, $k, $productIdList);
|
||||
createProduct($faker, $subcategory, $k, $template, $productIdList);
|
||||
}
|
||||
}
|
||||
|
||||
for($k=1; $k<rand(1, 6); $k++) {
|
||||
createProduct($faker, $category, $k, $productIdList);
|
||||
createProduct($faker, $category, $k, $template, $productIdList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +438,7 @@ try {
|
||||
$con->rollBack();
|
||||
}
|
||||
|
||||
function createProduct($faker, $category, $position, &$productIdList)
|
||||
function createProduct($faker, $category, $position, $template, &$productIdList)
|
||||
{
|
||||
$product = new Thelia\Model\Product();
|
||||
$product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8));
|
||||
@@ -424,6 +446,8 @@ function createProduct($faker, $category, $position, &$productIdList)
|
||||
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$product->setPosition($position);
|
||||
$product->setTaxRuleId(1);
|
||||
$product->setTemplate($template);
|
||||
|
||||
setI18n($faker, $product);
|
||||
|
||||
$product->save();
|
||||
@@ -521,18 +545,18 @@ function generate_image($image, $position, $typeobj, $id) {
|
||||
$image->save($image_file);
|
||||
}
|
||||
|
||||
function setI18n($faker, &$object)
|
||||
function setI18n($faker, &$object, $fields = array('Title' => 20, 'Description' => 50) )
|
||||
{
|
||||
$localeList = array('fr_FR', 'en_EN');
|
||||
|
||||
$title = $faker->text(20);
|
||||
$description = $faker->text(50);
|
||||
$localeList = $localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
|
||||
|
||||
foreach($localeList as $locale) {
|
||||
$object->setLocale($locale);
|
||||
|
||||
$object->setTitle($locale . ' : ' . $title);
|
||||
$object->setDescription($locale . ' : ' . $description);
|
||||
foreach($fields as $name => $length) {
|
||||
$func = "set".ucfirst(strtolower($name));
|
||||
|
||||
$object->$func($locale . ' : ' . $faker->text($length));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user