From 581e76da81669b0bbfd5c1eef30dd05e0e8a60da Mon Sep 17 00:00:00 2001
From: vAugagneur
Date: Wed, 26 Sep 2012 08:20:28 +0000
Subject: [PATCH] [-] FO : fixed bug #PSCFV-4357, #PSCFV-4270
---
controllers/front/AuthController.php | 35 +++++++++++--------
controllers/front/OrderController.php | 2 +-
.../blockcustomerprivacy.php | 2 +-
themes/default/authentication.tpl | 5 +--
4 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php
index 3c539e18a..7ff21ca60 100644
--- a/controllers/front/AuthController.php
+++ b/controllers/front/AuthController.php
@@ -96,23 +96,22 @@ class AuthControllerCore extends FrontController
if (!empty($key))
$back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key;
if (!empty($back))
- {
$this->context->smarty->assign('back', Tools::safeOutput($back));
- if (strpos($back, 'order') !== false)
- {
- if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES'))
- $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
- else
- $countries = Country::getCountries($this->context->language->id, true);
+
+ if (Tools::getValue('display_guest_checkout'))
+ {
+ if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES'))
+ $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
+ else
+ $countries = Country::getCountries($this->context->language->id, true);
- $this->context->smarty->assign(array(
- 'inOrderProcess' => true,
- 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
- 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
- 'sl_country' => (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')),
- 'countries' => $countries
- ));
- }
+ $this->context->smarty->assign(array(
+ 'inOrderProcess' => true,
+ 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
+ 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
+ 'sl_country' => (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')),
+ 'countries' => $countries
+ ));
}
if (Tools::getValue('create_account'))
@@ -400,6 +399,7 @@ class AuthControllerCore extends FrontController
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
{
+
if (!count($this->errors))
{
if (Tools::isSubmit('newsletter'))
@@ -515,6 +515,7 @@ class AuthControllerCore extends FrontController
$this->processCustomerNewsletter($customer);
$customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
+
if (!count($this->errors))
{
// if registration type is in one step, we save the address
@@ -605,6 +606,10 @@ class AuthControllerCore extends FrontController
if (count($this->errors))
{
+ //for retro compatibility to display guest account creation form on authentication page
+ if (Tools::getValue('submitGuestAccount'))
+ $_GET['display_guest_checkout'] = 1;
+
if (!Tools::getValue('is_new_customer'))
unset($_POST['passwd']);
if ($this->ajax)
diff --git a/controllers/front/OrderController.php b/controllers/front/OrderController.php
index adeaa0fb5..f69211804 100644
--- a/controllers/front/OrderController.php
+++ b/controllers/front/OrderController.php
@@ -64,7 +64,7 @@ class OrderControllerCore extends ParentOrderController
);
}
if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3)))
- Tools::redirect($this->context->link->getPageLink('authentication', true, (int)$this->context->language->id, 'back='.$this->context->link->getPageLink('order', true, (int)$this->context->language->id, 'step='.$this->step.'&multi-shipping='.(int)Tools::getValue('multi-shipping')).'&multi-shipping='.(int)Tools::getValue('multi-shipping')));
+ Tools::redirect($this->context->link->getPageLink('authentication', true, (int)$this->context->language->id, 'back='.$this->context->link->getPageLink('order', true, (int)$this->context->language->id, 'step='.$this->step.'&multi-shipping='.(int)Tools::getValue('multi-shipping')).'&multi-shipping='.(int)Tools::getValue('multi-shipping').'&display_guest_checkout='.(int)Configuration::get('PS_GUEST_CHECKOUT_ENABLED')));
if (Tools::getValue('multi-shipping') == 1)
$this->context->smarty->assign('multi_shipping', true);
diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php
index 80fda39fe..275454c4f 100644
--- a/modules/blockcustomerprivacy/blockcustomerprivacy.php
+++ b/modules/blockcustomerprivacy/blockcustomerprivacy.php
@@ -169,7 +169,7 @@ class Blockcustomerprivacy extends Module
{
if (!$this->checkConfig())
return;
- $this->context->controller->addJS(($this->_path).'blockcustomerprivacy.js');
+ $this->context->controller->addJS($this->_path.'blockcustomerprivacy.js');
}
public function hookActionBeforeSubmitAccount($params)
diff --git a/themes/default/authentication.tpl b/themes/default/authentication.tpl
index c6105de32..d5f224c9d 100644
--- a/themes/default/authentication.tpl
+++ b/themes/default/authentication.tpl
@@ -344,8 +344,10 @@ $(function(){ldelim}
{l s='DNI / NIF / NIE'}
+ {$HOOK_CREATE_ACCOUNT_FORM}
*{l s='Required field'}
+
@@ -575,6 +577,5 @@ $(function(){ldelim}
*{l s='Required field'}
-
-{/if}
+{/if}
\ No newline at end of file