diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 2bb01a94a..7f956287e 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -104,6 +104,24 @@ class CustomerController extends BaseFrontController $this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent); + $newCustomer = $customerCreateEvent->getCustomer(); + + // Newsletter + if (true === $form->get('newsletter')->getData()) { + $newsletterEmail = $newCustomer->getEmail(); + $nlEvent = new NewsletterEvent($newsletterEmail, $this->getRequest()->getSession()->getLang()->getLocale()); + $nlEvent->setFirstname($newCustomer->getFirstname()); + $nlEvent->setLastname($newCustomer->getLastname()); + + // Security : Check if this new Email address already exist + if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterEmail)) { + $nlEvent->setId($newsletter->getId()); + $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent); + } else { + $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent); + } + } + $this->processLogin($customerCreateEvent->getCustomer()); $cart = $this->getCart($this->getRequest()); diff --git a/core/lib/Thelia/Form/CustomerCreateForm.php b/core/lib/Thelia/Form/CustomerCreateForm.php index 38da394cc..35954dc88 100755 --- a/core/lib/Thelia/Form/CustomerCreateForm.php +++ b/core/lib/Thelia/Form/CustomerCreateForm.php @@ -89,6 +89,14 @@ class CustomerCreateForm extends AddressCreateForm "for" => "password_confirmation" ) )) + // Add Newsletter + ->add("newsletter", "checkbox", array( + "label" => Translator::getInstance()->trans('I would like to receive the newsletter or the latest news.'), + "label_attr" => array( + "for" => "newsletter" + ), + "required" => false + )) // Add terms & conditions ->add("agreed", "checkbox", array( "constraints" => array( diff --git a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php index c7ebd2c43..3bf0c372a 100755 --- a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php @@ -55,16 +55,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm ->remove("password") ->remove("password_confirm") // Remove Terms & conditions - ->remove("agreed") - - // Add Newsletter - ->add("newsletter", "checkbox", array( - "label" => Translator::getInstance()->trans('I would like to receive the newsletter or the latest news.'), - "label_attr" => array( - "for" => "newsletter" - ), - "required" => false - )); + ->remove("agreed"); } /** diff --git a/core/lib/Thelia/Form/NewsletterForm.php b/core/lib/Thelia/Form/NewsletterForm.php index ad0aab5a4..2dc910c1d 100644 --- a/core/lib/Thelia/Form/NewsletterForm.php +++ b/core/lib/Thelia/Form/NewsletterForm.php @@ -83,7 +83,7 @@ class NewsletterForm extends BaseForm { $customer = NewsletterQuery::create()->findOneByEmail($value); if ($customer) { - $context->addViolation("You are already subscribed!"); + $context->addViolation("You are already registered!"); } } diff --git a/templates/admin/default/I18n/fr_FR.php b/templates/admin/default/I18n/fr_FR.php index 2de503905..edccca64e 100755 --- a/templates/admin/default/I18n/fr_FR.php +++ b/templates/admin/default/I18n/fr_FR.php @@ -79,7 +79,7 @@ return array ( 'Address Line 2' => 'Adresse suite', 'Additional address' => 'Adresse complémentaire', 'Address Line 3' => 'Adresse suite', - 'Zip code' => 'Code posta', + 'Zip code' => 'Code postal', 'City' => 'Ville', 'Country' => 'Pays', 'Email Address' => 'Adresse e-mail', diff --git a/templates/default/I18n/fr_FR.php b/templates/default/I18n/fr_FR.php index 2aaec2b6e..82a4581c4 100755 --- a/templates/default/I18n/fr_FR.php +++ b/templates/default/I18n/fr_FR.php @@ -148,7 +148,7 @@ return array( 'Rating' => 'Avis', 'Ref.' => '', 'Register!' => 'S\'inscrire !', - 'Register' => 'Se connecter', + 'Register' => 'S\'inscrire', 'Regular Price:' => 'Prix :', 'Related' => 'Liés', // voir le contexte pour l'accord 'Remove this address' => 'Supprimer cette adresse', @@ -165,7 +165,7 @@ return array( 'Send' => 'Envoyer', 'Shipping Tax' => 'Frais de livraison', 'Show' => 'Voir', - 'Sign In' => 'S\'inscrire', + 'Sign In' => 'Se connecter', 'Sign up to receive our latest news.' => 'Inscrivez-vous pour recevoir nos actualités.', 'Skip to content' => 'Aller au contenu', 'Sort By' => 'Trier par', diff --git a/templates/default/account.html b/templates/default/account.html index 639ea25a2..73da05a66 100644 --- a/templates/default/account.html +++ b/templates/default/account.html @@ -156,7 +156,7 @@ {$REF} {format_date date=$CREATE_DATE} - {loop type="currency" name="order.currency" id={$CURRENCY}}{$SYMBOL}{/loop} {format_number number=$TOTAL_TAXED_AMOUNT} + {format_number number=$TOTAL_TAXED_AMOUNT} {loop type="currency" name="order.currency" id={$CURRENCY}}{$SYMBOL}{/loop} {loop type="order-status" name="order.status" id={$STATUS}}{$TITLE}{/loop} {intl l="Order details"} diff --git a/templates/default/cart.html b/templates/default/cart.html index 73cd57ddc..592b5f34c 100644 --- a/templates/default/cart.html +++ b/templates/default/cart.html @@ -89,11 +89,11 @@ {if $IS_PROMO == 1} {assign "real_price" $PROMO_TAXED_PRICE} -
{currency attr="symbol"} {$PROMO_TAXED_PRICE}
- {intl l="instead of"} {currency attr="symbol"} {$TAXED_PRICE} +
{$PROMO_TAXED_PRICE} {currency attr="symbol"}
+ {intl l="instead of"} {$TAXED_PRICE} {currency attr="symbol"} {else} {assign "real_price" $TAXED_PRICE} -
{currency attr="symbol"} {$TAXED_PRICE}
+
{$TAXED_PRICE} {currency attr="symbol"}
{/if} @@ -109,7 +109,7 @@ - {currency attr="symbol"} {$real_price * $QUANTITY} + {$real_price * $QUANTITY} {currency attr="symbol"} @@ -121,7 +121,7 @@ {intl l="Total"}
- {currency attr="symbol"} {cart attr="total_taxed_price"} + {cart attr="total_taxed_price"} {currency attr="symbol"}
diff --git a/templates/default/includes/addedToCart.html b/templates/default/includes/addedToCart.html index 273162529..e90fc6029 100644 --- a/templates/default/includes/addedToCart.html +++ b/templates/default/includes/addedToCart.html @@ -18,11 +18,11 @@ {if $IS_PROMO == 1} {assign "real_price" $PROMO_TAXED_PRICE} -
{currency attr="symbol"} {$PROMO_TAXED_PRICE}
- {currency attr="symbol"} {$TAXED_PRICE} +
{$PROMO_TAXED_PRICE} {currency attr="symbol"}
+ {$TAXED_PRICE} {currency attr="symbol"} {else} {assign "real_price" $TAXED_PRICE} -
{currency attr="symbol"} {$TAXED_PRICE}
+
{$TAXED_PRICE} {currency attr="symbol"}
{/if} diff --git a/templates/default/includes/mini-cart.html b/templates/default/includes/mini-cart.html index 2858d535b..96e0126b7 100644 --- a/templates/default/includes/mini-cart.html +++ b/templates/default/includes/mini-cart.html @@ -34,7 +34,7 @@ {else} {assign "real_price" $TAXED_PRICE} {/if} - {$QUANTITY} X {currency attr="symbol"}{$real_price} + {$QUANTITY} X {$real_price} {currency attr="symbol"} {assign "total_price" $total_price + ($QUANTITY * $real_price)} @@ -49,7 +49,7 @@
- {currency attr="symbol"}{$total_price} + {$total_price} {currency attr="symbol"}
diff --git a/templates/default/includes/toolbar.html b/templates/default/includes/toolbar.html index ff8b0d69b..967c63b8d 100644 --- a/templates/default/includes/toolbar.html +++ b/templates/default/includes/toolbar.html @@ -41,25 +41,11 @@
{intl l="Pagination"} diff --git a/templates/default/order-delivery.html b/templates/default/order-delivery.html index c38b3fb0f..2576ee381 100644 --- a/templates/default/order-delivery.html +++ b/templates/default/order-delivery.html @@ -134,7 +134,7 @@ {/if} {/form_field}
diff --git a/templates/default/order-invoice.html b/templates/default/order-invoice.html index d75c08b78..83c71c485 100644 --- a/templates/default/order-invoice.html +++ b/templates/default/order-invoice.html @@ -103,18 +103,18 @@ {if $IS_PROMO == 1} {assign "real_price" $PROMO_TAXED_PRICE} -
{currency attr="symbol"} {$PROMO_TAXED_PRICE}
- {intl l="instead of"} {currency attr="symbol"} {$TAXED_PRICE} +
{$PROMO_TAXED_PRICE} {currency attr="symbol"}
+ {intl l="instead of"} {$TAXED_PRICE} {currency attr="symbol"} {else} {assign "real_price" $TAXED_PRICE} -
{currency attr="symbol"} {$TAXED_PRICE}
+
{$TAXED_PRICE} {currency attr="symbol"}
{/if} {$QUANTITY} - {currency attr="symbol"} {$real_price * $QUANTITY} + {$real_price * $QUANTITY} {currency attr="symbol"} @@ -127,7 +127,7 @@ {intl l="Shipping Tax"}
- {currency attr="symbol"} {order attr="postage"} + {order attr="postage"} {currency attr="symbol"}
@@ -153,7 +153,7 @@ {intl l="Total"}
- {currency attr="symbol"} {{cart attr="total_taxed_price"} + {order attr="postage"}} + {{cart attr="total_taxed_price"} + {order attr="postage"}} {currency attr="symbol"}
diff --git a/templates/default/order-placed.html b/templates/default/order-placed.html index 4931896f5..c8a1a24f2 100644 --- a/templates/default/order-placed.html +++ b/templates/default/order-placed.html @@ -42,7 +42,7 @@
{intl l="Date"} :
{format_date date=$CREATE_DATE output="date"}
{intl l="Total"} :
-
{loop type="currency" name="order-currency" id=$CURRENCY}{$SYMBOL}{/loop} {$TOTAL_TAXED_AMOUNT}
+
{$TOTAL_TAXED_AMOUNT} {loop type="currency" name="order-currency" id=$CURRENCY}{$SYMBOL}{/loop}
diff --git a/templates/default/register.html b/templates/default/register.html index 66fd5e052..50a20f2ee 100644 --- a/templates/default/register.html +++ b/templates/default/register.html @@ -245,6 +245,21 @@ + {form_field form=$form field="newsletter"} +
+
+
+ + {if $error } + {$message} + {/if} +
+
+
+ {/form_field} + {form_field form=$form field="agreed"}
@@ -262,7 +277,7 @@
- +