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

@@ -86,17 +86,8 @@ class CustomerCreateForm extends AddressCreateForm
"for" => "newsletter" "for" => "newsletter"
), ),
"required" => false "required" => false
))
// Add terms & conditions
->add("agreed", "checkbox", array(
"constraints" => array(
new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register.")))
),
"label"=>"Test",
"label_attr" => array(
"for" => "agreed"
)
)); ));
} }
public function verifyPasswordField($value, ExecutionContextInterface $context) public function verifyPasswordField($value, ExecutionContextInterface $context)

View File

@@ -43,9 +43,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm
->remove("country") ->remove("country")
// Remove Login Information // Remove Login Information
->remove("password") ->remove("password")
->remove("password_confirm") ->remove("password_confirm");
// Remove Terms & conditions
->remove("agreed");
} }
/** /**

View File

@@ -50,6 +50,16 @@ class OrderPayment extends FirewallForm
) )
)) ))
) )
))
// Add terms & conditions
->add("agreed", "checkbox", array(
"constraints" => array(
new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register.")))
),
"label"=>"Agreed",
"label_attr" => array(
"for" => "agreed"
)
)); ));
} }

View File

@@ -81,6 +81,12 @@ try {
createProduct($faker, $categories, $brands, $contents, $template, $color, $material, $con); createProduct($faker, $categories, $brands, $contents, $template, $color, $material, $con);
createCustomer($faker, $con);
// set some config key
createConfig($faker, $folders, $contents, $con);
$con->commit(); $con->commit();
} catch (Exception $e) { } catch (Exception $e) {
echo "error : ".$e->getMessage()."\n"; echo "error : ".$e->getMessage()."\n";
@@ -228,6 +234,61 @@ function createProduct($faker, $categories, $brands, $contents, $template, $attr
echo "end creating products\n"; 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) function createMaterials($con)
{ {
@@ -382,12 +443,12 @@ function createFolders($faker, $con)
->setPosition($row-1) ->setPosition($row-1)
->setLocale('fr_FR') ->setLocale('fr_FR')
->setTitle(trim($data[0])) ->setTitle(trim($data[0]))
->setChapo(trim($data[2]) || $faker->text(20)) ->setChapo($faker->text(20))
->setDescription(trim($data[4]) || $faker->text(100)) ->setDescription($faker->text(100))
->setLocale('en_US') ->setLocale('en_US')
->setTitle(trim($data[1])) ->setTitle(trim($data[1]))
->setChapo(trim($data[3]) || $faker->text(20)) ->setChapo($faker->text(20))
->setDescription(trim($data[5]) || $faker->text(100)) ->setDescription($faker->text(100))
->save($con); ->save($con);
$folders[trim($data[1])] = $folder; $folders[trim($data[1])] = $folder;
@@ -432,12 +493,12 @@ function createContents($faker, $folders, $con)
->setPosition($row-1) ->setPosition($row-1)
->setLocale('fr_FR') ->setLocale('fr_FR')
->setTitle(trim($data[0])) ->setTitle(trim($data[0]))
->setChapo(trim($data[2])) ->setChapo($faker->text(20))
->setDescription(trim($data[4])) ->setDescription($faker->text(200))
->setLocale('en_US') ->setLocale('en_US')
->setTitle(trim($data[1])) ->setTitle(trim($data[1]))
->setChapo(trim($data[3])) ->setChapo($faker->text(20))
->setDescription(trim($data[5])); ->setDescription($faker->text(200));
// folder // folder
$contentFolders = explode(';', $data[7]); $contentFolders = explode(';', $data[7]);
@@ -565,7 +626,6 @@ function clearTables($con)
->find($con); ->find($con);
$brand->delete($con); $brand->delete($con);
$category = Thelia\Model\CategoryQuery::create() $category = Thelia\Model\CategoryQuery::create()
->find($con); ->find($con);
$category->delete($con); $category->delete($con);
@@ -612,6 +672,10 @@ function clearTables($con)
\Thelia\Model\ProductImageQuery::create()->find($con)->delete($con); \Thelia\Model\ProductImageQuery::create()->find($con)->delete($con);
$customer = Thelia\Model\CustomerQuery::create()
->find();
$customer->delete();
echo "Tables cleared with success\n"; 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()), ('unknown-flag-path','assets/img/flags/unknown.png', 0, 0, NOW(), NOW()),
('html_output_trim_level','1', 0, 0, NOW(), NOW()), ('html_output_trim_level','1', 0, 0, NOW(), NOW()),
('default_available_stock', '100', 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()), ('session_config.default', '1', 1, 1, NOW(), NOW()),
('default_lang_without_translation', '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), (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), (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), (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), (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), (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), (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), (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), (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), (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 INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES

View File

@@ -226,10 +226,6 @@
<input type="hidden" name="{$name}" value="random" /> <input type="hidden" name="{$name}" value="random" />
{/form_field} {/form_field}
{form_field form=$form field="agreed"}
<input type="hidden" name="{$name}" value="on" />
{/form_field}
{form_field form=$form field='company'} {form_field form=$form field='company'}
<div class="form-group {if $error}has-error{/if}"> <div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label> <label for="{$label_attr.for}" class="control-label">{$label} : </label>

View File

@@ -31,7 +31,7 @@
{block name="main-content"} {block name="main-content"}
<div class="main layout-col-2-left"> <div class="main layout-col-2-left">
<article class="col-main" role="main" aria-labelledby="main-label"> <article id="content-main" class="col-main" role="main" aria-labelledby="main-label">
{loop name="blog.content" type="content" current="yes"} {loop name="blog.content" type="content" current="yes"}
<h1 id="main-label" class="page-header">{$TITLE}</h1> <h1 id="main-label" class="page-header">{$TITLE}</h1>
{if $CHAPO} {if $CHAPO}

View File

@@ -414,11 +414,12 @@ GNU General Public License : http://www.gnu.org/licenses/
<div class="info"> <div class="info">
<nav class="nav-footer" role="navigation"> <nav class="nav-footer" role="navigation">
<ul> <ul>
{loop name="footer_links" type="content" folder="2"} {$folder_information={config key="information_folder_id"}}
{if $folder_information}
{loop name="footer_links" type="content" folder=$folder_information}
<li><a href="{$URL}">{$TITLE}</a></li> <li><a href="{$URL}">{$TITLE}</a></li>
{/loop} {/loop}
{*<li><a href="#">Site Map</a></li> {/if}
<li><a href="#">Terms & Conditions</a></li>*}
<li><a href="{url path="/contact"}">{intl l="Contact Us"}</a></li> <li><a href="{url path="/contact"}">{intl l="Contact Us"}</a></li>
</ul> </ul>
</nav> </nav>

View File

@@ -309,7 +309,30 @@
</ul> </ul>
</div> </div>
</div> </div>
{/form_field}
{form_field form=$form field="agreed"}
<div class="well">
<div class="form-group group-agreed{if $error} has-error{/if}">
<div class="control-input">
<div class="checkbox">
<label class="control-label" for="{$label_attr.for}">
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="{$value}"{if $checked} checked{/if} {if $required} aria-required="true" required{/if}>
{$termsAndConditionsId={config key="terms_conditions_content_id"}}
{if $termsAndConditionsId}
{loop name="content-terms" type="content" id=$termsAndConditionsId}
{$termsAndConditionsUrl=$URL}
{/loop}
{/if}
{intl l="I've read and agreed on <a href='%link' class='terms-quickview'>Terms &amp; Conditions</a>" link="$termsAndConditionsUrl"}.
</label>
{if $error }
<span class="help-block">{$message}</span>
{/if}
</div>
</div>
</div><!--/.form-group-->
</div>
{/form_field} {/form_field}
<a href="{url path="/order/delivery"}" role="button" class="btn btn-back"><span>{intl l="Back"}</span></a> <a href="{url path="/order/delivery"}" role="button" class="btn btn-back"><span>{intl l="Back"}</span></a>
@@ -338,6 +361,25 @@ jQuery(function($) {
return false; return false;
}); });
}); });
$(".terms-quickview").on('click', function (ev) {
ev.preventDefault();
$.get(this.href, function (data) {
// Hide all currently active bootbox dialogs
bootbox.hideAll();
// Show dialog
bootbox.dialog({
message : $("#content-main",data),
onEscape: function() {
bootbox.hideAll();
}
});
});
return false;
});
}); });
</script> </script>
{/block} {/block}

View File

@@ -262,21 +262,6 @@
</div><!--/.form-group--> </div><!--/.form-group-->
{/form_field} {/form_field}
{form_field form=$form field="agreed"}
<div class="form-group group-agreed{if $error} has-error{/if}">
<div class="control-input">
<div class="checkbox">
<label class="control-label" for="{$label_attr.for}">
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="{$value}"{if $checked} checked{/if} {if $required} aria-required="true" required{/if}>{intl l="I've read and agreed on <a href='#'>Terms &amp; Conditions</a>"}.
</label>
{if $error }
<span class="help-block">{$message}</span>
{/if}
</div>
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-btn"> <div class="form-group group-btn">
<div class="control-btn"> <div class="control-btn">
<button type="submit" class="btn btn-register">{intl l="Register"}</button> <button type="submit" class="btn btn-register">{intl l="Register"}</button>