11<?php
2- /*
3- * 2007-2015 PrestaShop
4- *
5- * NOTICE OF LICENSE
6- *
7- * This source file is subject to the Academic Free License (AFL 3.0)
8- * that is bundled with this package in the file LICENSE.txt.
9- * It is also available through the world-wide-web at this URL:
10- * http ://opensource.org/licenses/afl -3.0.php
11- * If you did not receive a copy of the license and are unable to
12- * obtain it through the world-wide-web, please send an email
13- * to [email protected] so we can send you a copy immediately. 14- *
15- * DISCLAIMER
16- *
17- * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18- * versions in the future. If you wish to customize PrestaShop for your
19- * needs please refer to http://www.prestashop.com for more information.
20- *
21- * @author PrestaShop SA <[email protected] >22- * @copyright 2007-2015 PrestaShop SA
23- * @license http ://opensource.org/licenses/afl -3.0.php Academic Free License (AFL 3.0)
24- * International Registered Trademark & Property of PrestaShop SA
25- */
2+ /**
3+ * 2007-2020 PrestaShop.
4+ *
5+ * NOTICE OF LICENSE
6+ *
7+ * This source file is subject to the Academic Free License 3.0 (AFL- 3.0)
8+ * that is bundled with this package in the file LICENSE.txt.
9+ * It is also available through the world-wide-web at this URL:
10+ * https ://opensource.org/licenses/AFL -3.0
11+ * If you did not receive a copy of the license and are unable to
12+ * obtain it through the world-wide-web, please send an email
13+ * to [email protected] so we can send you a copy immediately.14+ *
15+ * DISCLAIMER
16+ *
17+ * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+ * versions in the future. If you wish to customize PrestaShop for your
19+ * needs please refer to http://www.prestashop.com for more information.
20+ *
21+ * @author PrestaShop SA <[email protected] >22+ * @copyright 2007-2020 PrestaShop SA
23+ * @license https ://opensource.org/licenses/AFL -3.0 Academic Free License 3.0 (AFL- 3.0)
24+ * International Registered Trademark & Property of PrestaShop SA
25+ */
2626
2727/**
2828 * @since 1.5.0
@@ -36,12 +36,11 @@ class Ps_EmailsubscriptionSubscriptionModuleFrontController extends ModuleFrontC
3636 */
3737 public function postProcess ()
3838 {
39-
4039 $ this ->variables ['value ' ] = Tools::getValue ('email ' , '' );
4140 $ this ->variables ['msg ' ] = '' ;
4241 $ this ->variables ['conditions ' ] = Configuration::get ('NW_CONDITIONS ' , $ this ->context ->language ->id );
4342
44- if (Tools::isSubmit ('submitNewsletter ' )) {
43+ if (Tools::isSubmit ('submitNewsletter ' ) || $ this -> ajax ) {
4544 $ this ->module ->newsletterRegistration ();
4645 if ($ this ->module ->error ) {
4746 $ this ->variables ['msg ' ] = $ this ->module ->error ;
@@ -50,8 +49,12 @@ public function postProcess()
5049 $ this ->variables ['msg ' ] = $ this ->module ->valid ;
5150 $ this ->variables ['nw_error ' ] = false ;
5251 }
53- }
5452
53+ if ($ this ->ajax ) {
54+ header ('Content-Type: application/json ' );
55+ $ this ->ajaxDie (json_encode ($ this ->variables ));
56+ }
57+ }
5558 }
5659
5760 /**
0 commit comments