// Fix guest-tracking links
This commit is contained in:
@@ -47,17 +47,24 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
|
||||
/* check if the cart has been made by a Guest customer, for redirect link */
|
||||
if (Cart::isGuestCartByCartId($this->id_cart))
|
||||
{
|
||||
$is_guest = true;
|
||||
$redirectLink = 'index.php?controller=guest-tracking';
|
||||
}
|
||||
else
|
||||
$redirectLink = 'index.php?controller=history';
|
||||
|
||||
$this->id_module = (int)(Tools::getValue('id_module', 0));
|
||||
$this->id_order = Order::getOrderByCartId((int)($this->id_cart));
|
||||
$this->secure_key = Tools::getValue('key', false);
|
||||
$order = new Order((int)($this->id_order));
|
||||
if ($is_guest)
|
||||
{
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
$redirectLink .= '&id_order='.$order->reference.'&email='.urlencode($customer->email);
|
||||
}
|
||||
if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key))
|
||||
Tools::redirect($redirectLink.(Tools::isSubmit('slowvalidation') ? '&slowvalidation' : ''));
|
||||
|
||||
$order = new Order((int)($this->id_order));
|
||||
$this->reference = $order->reference;
|
||||
if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key)
|
||||
Tools::redirect($redirectLink);
|
||||
@@ -85,7 +92,8 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
$this->context->smarty->assign(array(
|
||||
'id_order' => $this->id_order,
|
||||
'reference_order' => $this->reference,
|
||||
'id_order_formatted' => sprintf('#%06d', $this->id_order)
|
||||
'id_order_formatted' => sprintf('#%06d', $this->id_order),
|
||||
'email' => $this->context->customer->email
|
||||
));
|
||||
/* If guest we clear the cookie for security reason */
|
||||
$this->context->customer->mylogout();
|
||||
|
||||
@@ -171,9 +171,10 @@ class OrderControllerCore extends ParentOrderController
|
||||
{
|
||||
if ($this->context->customer->is_guest)
|
||||
{
|
||||
$order = new Order((int)$id_order);
|
||||
$email = $this->context->customer->email;
|
||||
$this->context->customer->mylogout(); // If guest we clear the cookie for security reason
|
||||
Tools::redirect('index.php?controller=guest-tracking&id_order='.(int)$id_order.'&email='.urlencode($email));
|
||||
Tools::redirect('index.php?controller=guest-tracking&id_order='.(int)$order->reference.'&email='.urlencode($email);
|
||||
}
|
||||
else
|
||||
Tools::redirect('index.php?controller=history');
|
||||
|
||||
@@ -165,10 +165,11 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
/* Bypass payment step if total is 0 */
|
||||
if (($id_order = $this->_checkFreeOrder()) && $id_order)
|
||||
{
|
||||
$order = new Order((int)$id_order);
|
||||
$email = $this->context->customer->email;
|
||||
if ($this->context->customer->is_guest)
|
||||
$this->context->customer->logout(); // If guest we clear the cookie for security reason
|
||||
die('freeorder:'.$id_order.':'.$email);
|
||||
die('freeorder:'.$order->reference.':'.$email);
|
||||
}
|
||||
exit;
|
||||
break;
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
<br />
|
||||
{if $is_guest}
|
||||
<p>{l s='Your order ID is:'} <span class="bold">{$id_order_formatted}</span> . {l s='Your order ID has been sent to you via e-mail.'}</p>
|
||||
<a href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order}")}" title="{l s='Follow my order'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Follow my order'}" class="icon" /></a>
|
||||
<a href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order}")}" title="{l s='Follow my order'}">{l s='Follow my order'}</a>
|
||||
<a href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order}&email={$email}")}" title="{l s='Follow my order'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Follow my order'}" class="icon" /></a>
|
||||
<a href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order}&email={$email}")}" title="{l s='Follow my order'}">{l s='Follow my order'}</a>
|
||||
{else}
|
||||
<a href="{$link->getPageLink('history', true)}" title="{l s='Back to orders'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Back to orders'}" class="icon" /></a>
|
||||
<a href="{$link->getPageLink('history', true)}" title="{l s='Back to orders'}">{l s='Back to orders'}</a>
|
||||
|
||||
Reference in New Issue
Block a user