diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index f73e2712c..3e0c39939 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -187,7 +187,12 @@ - + + Thelia\Controller\Front\DefaultController::noAction + newsletter + + + Thelia\Controller\Front\NewsletterController::subscribeAction newsletter diff --git a/core/lib/Thelia/Controller/Front/NewsletterController.php b/core/lib/Thelia/Controller/Front/NewsletterController.php index bdc52db75..636923f5b 100644 --- a/core/lib/Thelia/Controller/Front/NewsletterController.php +++ b/core/lib/Thelia/Controller/Front/NewsletterController.php @@ -62,8 +62,8 @@ class NewsletterController extends BaseFrontController $error_message = $e->getMessage(); } - if($error_message) { - \Thelia\Log\Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message)); + if($error_message !== false) { + \Thelia\Log\Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $error_message)); $newsletterForm->setErrorMessage($error_message); diff --git a/core/lib/Thelia/Form/NewsletterForm.php b/core/lib/Thelia/Form/NewsletterForm.php index 2bfff496c..3e70dde67 100644 --- a/core/lib/Thelia/Form/NewsletterForm.php +++ b/core/lib/Thelia/Form/NewsletterForm.php @@ -22,8 +22,10 @@ /*************************************************************************************/ namespace Thelia\Form; + use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Core\Translation\Translator; /** @@ -61,6 +63,10 @@ class NewsletterForm extends BaseForm 'constraints' => array( new NotBlank(), new Email() + ), + 'label' => Translator::getInstance()->trans('email'), + 'label_attr' => array( + 'for' => 'email_newsletter' ) )); } diff --git a/templates/default/layout.tpl b/templates/default/layout.tpl index 647b3267a..22e8cb5a5 100644 --- a/templates/default/layout.tpl +++ b/templates/default/layout.tpl @@ -297,13 +297,17 @@ URL: http://www.thelia.net

{intl l="Newsletter"}

{intl l="Sign up to receive our latest news."}

+ {form name="thelia.newsletter"}
+ {form_field form=$form field="email"}
- - + +
+ {/form_field}
+ {/form}
diff --git a/templates/default/newsletter-success.html b/templates/default/newsletter-success.html new file mode 100644 index 000000000..8c6820fe8 --- /dev/null +++ b/templates/default/newsletter-success.html @@ -0,0 +1,15 @@ +{extends file="layout.tpl"} + +{* Breadcrumb *} +{block name='no-return-functions' append} + {$breadcrumbs = [['title' => {intl l="Thanks !"}, 'url'=>{url path="/contact/success"}]]} +{/block} + +{block name="main-content"} +
+
+

{intl l="Thanks !"}

+

{intl l="Thanks for your subscrition to the newsletter"}

+
+
+{/block} \ No newline at end of file diff --git a/templates/default/newsletter.html b/templates/default/newsletter.html new file mode 100644 index 000000000..f7e4d25dc --- /dev/null +++ b/templates/default/newsletter.html @@ -0,0 +1,46 @@ +{extends file="layout.tpl"} + +{* Breadcrumb *} +{block name='no-return-functions' append} + {$breadcrumbs = [['title' => {intl l="Newsletter"}, 'url'=>{url path="/newsletter"}]]} +{/block} + +{block name="main-content"} +
+
+

{intl l="Newsletter"}

+ + {form name="thelia.newsletter"} +
+ {form_hidden_fields form=$form} +
+
+ 1. {intl l="Personal Informations"} +
+
+ {form_field form=$form field="email"} +
+ +
+ + {if $error } + {$message} + {assign var="error_focus" value="true"} + {elseif $value != "" && !$error} + + {/if} +
+
+ {/form_field} +
+
+ +
+
+
+
+
+ {/form} +
+
+{/block} \ No newline at end of file