Merge branch 'master' into cart

Conflicts:
	core/lib/Thelia/Core/Template/Loop/Category.php
	install/faker.php
This commit is contained in:
Manuel Raynaud
2013-08-07 10:23:44 +02:00
24 changed files with 1398 additions and 30 deletions

View File

@@ -42,13 +42,21 @@ try {
);
$folder = Thelia\Model\FolderQuery::create()
->find();
$folder->delete();
$content = Thelia\Model\ContentQuery::create()
->find();
$content->delete();
//first category
$sweet = new Thelia\Model\Category();
$sweet->setParent(0);
$sweet->setVisible(1);
$sweet->setPosition(1);
$sweet->setDescription($faker->text(255));
$sweet->setTitle($faker->bs);
$sweet->setTitle($faker->text(20));
$sweet->save();
@@ -58,7 +66,7 @@ try {
$jeans->setVisible(1);
$jeans->setPosition(2);
$jeans->setDescription($faker->text(255));
$jeans->setTitle($faker->bs);
$jeans->setTitle($faker->text(20));
$jeans->save();
@@ -68,14 +76,14 @@ try {
$other->setVisible(1);
$other->setPosition(3);
$other->setDescription($faker->text(255));
$other->setTitle($faker->bs);
$other->setTitle($faker->text(20));
$other->save();
for ($i=1; $i <= 5; $i++) {
$product = new \Thelia\Model\Product();
$product->addCategory($sweet);
$product->setTitle($faker->bs);
$product->setTitle($faker->text(20));
$product->setDescription($faker->text(250));
/* $product->setQuantity($faker->randomNumber(1,50));
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
@@ -101,7 +109,7 @@ try {
for ($i=1; $i <= 5; $i++) {
$product = new \Thelia\Model\Product();
$product->addCategory($jeans);
$product->setTitle($faker->bs);
$product->setTitle($faker->text(20));
$product->setDescription($faker->text(250));
/* $product->setQuantity($faker->randomNumber(1,50));
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
@@ -124,6 +132,60 @@ try {
}
//folders and contents
for($i=0; $i<4; $i++) {
$folder = new Thelia\Model\Folder();
$folder->setParent(0);
$folder->setVisible(rand(1, 10)>7 ? 0 : 1);
$folder->setPosition($i);
$folder->setTitle($faker->text(20));
$folder->setDescription($faker->text(255));
$folder->save();
for($j=0; $j<rand(0, 4); $j++) {
$subfolder = new Thelia\Model\Folder();
$subfolder->setParent($folder->getId());
$subfolder->setVisible(rand(1, 10)>7 ? 0 : 1);
$subfolder->setPosition($j);
$subfolder->setTitle($faker->text(20));
$subfolder->setDescription($faker->text(255));
$subfolder->save();
for($k=0; $k<rand(1, 5); $k++) {
$content = new Thelia\Model\Content();
$content->addFolder($subfolder);
$content->setVisible(rand(1, 10)>7 ? 0 : 1);
$content->setPosition($k);
$content->setTitle($faker->text(20));
$content->setDescription($faker->text(255));
$content->save();
}
}
}
//features and features_av
for($i=0; $i<4; $i++) {
$feature = new Thelia\Model\Feature();
$feature->setVisible(rand(1, 10)>7 ? 0 : 1);
$feature->setPosition($i);
$feature->setTitle($faker->text(20));
$feature->setDescription($faker->text(50));
$feature->save();
for($j=0; $j<rand(1, 5); $j++) {
$featureAv = new Thelia\Model\FeatureAv();
$featureAv->setFeature($feature);
$featureAv->setPosition($j);
$featureAv->setTitle($faker->text(20));
$featureAv->setDescription($faker->text(255));
$featureAv->save();
}
}
$con->commit();
} catch (Exception $e) {