//OrderReturnController : Refacto done

This commit is contained in:
mDeflotte committed 2011-09-29 09:05:03 +00:00
1 parent 0004b75bdc
commit 4bec27e51c
2 files changed
+17 -11

No files matched your search

+14 -10
View File
@@ -32,22 +32,19 @@ class OrderReturnControllerCore extends FrontController
public $authRedirection = 'order-follow'; public $authRedirection = 'order-follow';
public $ssl = true; public $ssl = true;
public function __construct() public function init()
{ {
parent::__construct(); parent::init();
header("Cache-Control: no-cache, must-revalidate"); header('Cache-Control: no-cache, must-revalidate');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
}
public function process() if (!isset($_GET['id_order_return']) || !Validate::isUnsignedId($_GET['id_order_return']))
{
if (!isset($_GET['id_order_return']) OR !Validate::isUnsignedId($_GET['id_order_return']))
$this->errors[] = Tools::displayError('Order ID required'); $this->errors[] = Tools::displayError('Order ID required');
else else
{ {
$orderRet = new OrderReturn((int)($_GET['id_order_return'])); $orderRet = new OrderReturn((int)($_GET['id_order_return']));
if (Validate::isLoadedObject($orderRet) AND $orderRet->id_customer == $this->context->cookie->id_customer) if (Validate::isLoadedObject($orderRet) && $orderRet->id_customer == $this->context->cookie->id_customer)
{ {
$order = new Order((int)($orderRet->id_order)); $order = new Order((int)($orderRet->id_order));
if (Validate::isLoadedObject($order)) if (Validate::isLoadedObject($order))
@@ -69,12 +66,19 @@ class OrderReturnControllerCore extends FrontController
else else
$this->errors[] = Tools::displayError('Cannot find this order return'); $this->errors[] = Tools::displayError('Cannot find this order return');
} }
}
/**
* Assign template vars related to page content
* @see FrontController::process()
*/
public function process()
{
parent::process();
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'errors' => $this->errors, 'errors' => $this->errors,
'nbdaysreturn' => (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS')) 'nbdaysreturn' => (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS'))
)); ));
$this->setTemplate(_PS_THEME_DIR_.'order-return.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-return.tpl');
} }
+3 -1
View File
@@ -23,7 +23,8 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{include file="$tpl_dir./errors.tpl"}
{if isset($orderRe)}
<h4>{l s='RE#'}<span class="color-myaccount">{$orderRet->id|string_format:"%06d"}</span> {l s='on'} {dateFormat date=$order->date_add full=0}</h4> <h4>{l s='RE#'}<span class="color-myaccount">{$orderRet->id|string_format:"%06d"}</span> {l s='on'} {dateFormat date=$order->date_add full=0}</h4>
<div> <div>
<p class="bold">{l s='We have logged your return request.'}</p> <p class="bold">{l s='We have logged your return request.'}</p>
@@ -104,3 +105,4 @@
{elseif $orderRet->state == 1} {elseif $orderRet->state == 1}
<p class="bold">{l s='You must wait for our confirmation before returning any merchandise.'}</p> <p class="bold">{l s='You must wait for our confirmation before returning any merchandise.'}</p>
{/if} {/if}
{/if}