Moved Terms aggrement from account to order, display terms and conditions
This commit is contained in:
committed by
Julien Chanseaume
parent
9410881da9
commit
160ccaa4ff
@@ -86,17 +86,8 @@ class CustomerCreateForm extends AddressCreateForm
|
||||
"for" => "newsletter"
|
||||
),
|
||||
"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)
|
||||
|
||||
@@ -43,9 +43,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm
|
||||
->remove("country")
|
||||
// Remove Login Information
|
||||
->remove("password")
|
||||
->remove("password_confirm")
|
||||
// Remove Terms & conditions
|
||||
->remove("agreed");
|
||||
->remove("password_confirm");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -226,10 +226,6 @@
|
||||
<input type="hidden" name="{$name}" value="random" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="agreed"}
|
||||
<input type="hidden" name="{$name}" value="on" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
{block name="main-content"}
|
||||
<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"}
|
||||
<h1 id="main-label" class="page-header">{$TITLE}</h1>
|
||||
{if $CHAPO}
|
||||
|
||||
@@ -414,11 +414,12 @@ GNU General Public License : http://www.gnu.org/licenses/
|
||||
<div class="info">
|
||||
<nav class="nav-footer" role="navigation">
|
||||
<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>
|
||||
{/loop}
|
||||
{*<li><a href="#">Site Map</a></li>
|
||||
<li><a href="#">Terms & Conditions</a></li>*}
|
||||
{/if}
|
||||
<li><a href="{url path="/contact"}">{intl l="Contact Us"}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
@@ -309,7 +309,30 @@
|
||||
</ul>
|
||||
</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 & Conditions</a>" link="$termsAndConditionsUrl"}.
|
||||
</label>
|
||||
{if $error }
|
||||
<span class="help-block">{$message}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/.form-group-->
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<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;
|
||||
});
|
||||
});
|
||||
|
||||
$(".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>
|
||||
{/block}
|
||||
|
||||
@@ -262,21 +262,6 @@
|
||||
</div><!--/.form-group-->
|
||||
{/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 & 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="control-btn">
|
||||
<button type="submit" class="btn btn-register">{intl l="Register"}</button>
|
||||
|
||||
Reference in New Issue
Block a user