Moved Terms aggrement from account to order, display terms and conditions

This commit is contained in:
Julien Chanséaume
2014-07-29 14:08:47 +02:00
committed by Julien Chanseaume
parent 9410881da9
commit 160ccaa4ff
10 changed files with 141 additions and 48 deletions

View File

@@ -81,6 +81,12 @@ try {
createProduct($faker, $categories, $brands, $contents, $template, $color, $material, $con);
createCustomer($faker, $con);
// set some config key
createConfig($faker, $folders, $contents, $con);
$con->commit();
} catch (Exception $e) {
echo "error : ".$e->getMessage()."\n";
@@ -228,6 +234,61 @@ function createProduct($faker, $categories, $brands, $contents, $template, $attr
echo "end creating products\n";
}
function createConfig($faker, $folders, $contents, $con){
// Store
\Thelia\Model\ConfigQuery::write("store_name", "Thelia");
\Thelia\Model\ConfigQuery::write("store_description", "E-commerce solution based on Symfony 2");
\Thelia\Model\ConfigQuery::write("store_email", "Thelia");
\Thelia\Model\ConfigQuery::write("store_address1", "5 rue Rochon");
\Thelia\Model\ConfigQuery::write("store_city", "Clermont-Ferrrand");
\Thelia\Model\ConfigQuery::write("store_phone", "+(33)444053102");
\Thelia\Model\ConfigQuery::write("store_email", "contact@thelia.net");
// Contents
\Thelia\Model\ConfigQuery::write("information_folder_id", $folders['Information']->getId());
\Thelia\Model\ConfigQuery::write("terms_conditions_content_id", $contents["Terms and Conditions"]->getId());
}
function createCustomer($faker, $con){
echo "Creating customer\n";
//customer
$customer = new Thelia\Model\Customer();
$customer->createOrUpdate(
1,
"thelia",
"thelia",
"5 rue rochon",
"",
"",
"0102030405",
"0601020304",
"63000",
"Clermont-Ferrand",
64,
"test@thelia.net",
"azerty"
);
for ($j = 0; $j <= 2; $j++) {
$address = new Thelia\Model\Address();
$address->setLabel($faker->text(20))
->setTitleId(rand(1,3))
->setFirstname($faker->firstname)
->setLastname($faker->lastname)
->setAddress1($faker->streetAddress)
->setAddress2($faker->streetAddress)
->setAddress3($faker->streetAddress)
->setCellphone($faker->phoneNumber)
->setPhone($faker->phoneNumber)
->setZipcode($faker->postcode)
->setCity($faker->city)
->setCountryId(64)
->setCustomer($customer)
->save($con)
;
}
}
function createMaterials($con)
{
@@ -382,12 +443,12 @@ function createFolders($faker, $con)
->setPosition($row-1)
->setLocale('fr_FR')
->setTitle(trim($data[0]))
->setChapo(trim($data[2]) || $faker->text(20))
->setDescription(trim($data[4]) || $faker->text(100))
->setChapo($faker->text(20))
->setDescription($faker->text(100))
->setLocale('en_US')
->setTitle(trim($data[1]))
->setChapo(trim($data[3]) || $faker->text(20))
->setDescription(trim($data[5]) || $faker->text(100))
->setChapo($faker->text(20))
->setDescription($faker->text(100))
->save($con);
$folders[trim($data[1])] = $folder;
@@ -432,12 +493,12 @@ function createContents($faker, $folders, $con)
->setPosition($row-1)
->setLocale('fr_FR')
->setTitle(trim($data[0]))
->setChapo(trim($data[2]))
->setDescription(trim($data[4]))
->setChapo($faker->text(20))
->setDescription($faker->text(200))
->setLocale('en_US')
->setTitle(trim($data[1]))
->setChapo(trim($data[3]))
->setDescription(trim($data[5]));
->setChapo($faker->text(20))
->setDescription($faker->text(200));
// folder
$contentFolders = explode(';', $data[7]);
@@ -565,7 +626,6 @@ function clearTables($con)
->find($con);
$brand->delete($con);
$category = Thelia\Model\CategoryQuery::create()
->find($con);
$category->delete($con);
@@ -612,6 +672,10 @@ function clearTables($con)
\Thelia\Model\ProductImageQuery::create()->find($con)->delete($con);
$customer = Thelia\Model\CustomerQuery::create()
->find();
$customer->delete();
echo "Tables cleared with success\n";
}

View File

@@ -37,6 +37,8 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('unknown-flag-path','assets/img/flags/unknown.png', 0, 0, NOW(), NOW()),
('html_output_trim_level','1', 0, 0, NOW(), NOW()),
('default_available_stock', '100', 0, 0, NOW(), NOW()),
('information_folder_id', '', 0, 0, NOW(), NOW()),
('terms_conditions_content_id', '', 0, 0, NOW(), NOW()),
('session_config.default', '1', 1, 1, NOW(), NOW()),
('default_lang_without_translation', '1', 1, 1, NOW(), NOW()),
@@ -91,6 +93,8 @@ INSERT INTO `config_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `pos
(28, 'en_US', 'The path (relative to the default back-office template) to the image used when no flag image can be found for a country', NULL, NULL, NULL),
(29, 'en_US', 'Whitespace trim level of the generated HTML code (0 = none, 1 = medium, 2 = maximum)', NULL, NULL, NULL),
(30, 'en_US', 'Default available stock when check-available-stock is set to 0.', NULL, NULL, NULL),
(31, 'en_US', 'The ID of the folder containing your information pages : terms, imprint, ...', NULL, NULL, NULL),
(32, 'en_US', 'The ID of the ''Terms & Conditions'' content.', NULL, NULL, NULL),
(1, 'fr_FR', 'Nom de la classe du gestionnaire de session', NULL, NULL, NULL),
(2, 'fr_FR', 'Vérifier la présence de produits en stock (1) ou l''ignorer (0) lors de l''affichage et la modification des quantités commandées', NULL, NULL, NULL),
(3, 'fr_FR', 'Nom du modèle de front-office actif', NULL, NULL, NULL),
@@ -120,7 +124,9 @@ INSERT INTO `config_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `pos
(27, 'fr_FR', 'Nom de la vue de la livraison dans le modèle PDF en cours (sans extension)', NULL, NULL, NULL),
(28, 'fr_FR', 'Le chemin (par rapport au modèle de back-office par défaut) vers l''image utilisée lorsque aucune image de drapeau ne peut être trouvée pour un pays', NULL, NULL, NULL),
(29, 'fr_FR', 'Niveau de découpe des espaces dans le code HTML généré (0 = aucun, 1 = moyen, 2 = maximum)', NULL, NULL, NULL),
(30, 'fr_FR', 'Stock disponible par défaut quand check-available-stock est à 0.', NULL, NULL, NULL);
(30, 'fr_FR', 'Stock disponible par défaut quand check-available-stock est à 0.', NULL, NULL, NULL),
(31, 'fr_FR', 'L''ID du dossier contenant vos pages d''informations : CGV, mentions légales, ...', NULL, NULL, NULL),
(32, 'fr_FR', 'L''ID du contenu de vos ''CGV''.', NULL, NULL, NULL);
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES