//OrderReturnController : Refacto done

This commit is contained in:
mDeflotte
2011-09-29 09:05:03 +00:00
parent 0004b75bdc
commit 4bec27e51c
2 changed files with 95 additions and 89 deletions
+15 -11
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');
} }
+80 -78
View File
@@ -23,84 +23,86 @@
* @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"}
<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> {if isset($orderRe)}
<div> <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>
<p class="bold">{l s='We have logged your return request.'}</p> <div>
<p>{l s='Your package must be returned to us within'} {$nbdaysreturn} {l s='days of receiving your order.'}</p> <p class="bold">{l s='We have logged your return request.'}</p>
<p>{l s='Current status of your merchandise return:'} <span class="bold">{$state_name|escape:'htmlall':'UTF-8'}</span></p> <p>{l s='Your package must be returned to us within'} {$nbdaysreturn} {l s='days of receiving your order.'}</p>
<p>{l s='List of items marked as returned:'}</p> <p>{l s='Current status of your merchandise return:'} <span class="bold">{$state_name|escape:'htmlall':'UTF-8'}</span></p>
</div> <p>{l s='List of items marked as returned:'}</p>
<div id="order-detail-content" class="table_block"> </div>
<table class="std"> <div id="order-detail-content" class="table_block">
<thead> <table class="std">
<tr> <thead>
<th class="first_item">{l s='Reference'}</th> <tr>
<th class="item">{l s='Product'}</th> <th class="first_item">{l s='Reference'}</th>
<th class="last_item">{l s='Quantity'}</th> <th class="item">{l s='Product'}</th>
</tr> <th class="last_item">{l s='Quantity'}</th>
</thead> </tr>
<tbody> </thead>
{foreach from=$products item=product name=products} <tbody>
{foreach from=$products item=product name=products}
{assign var='quantityDisplayed' value=0}
{foreach from=$returnedCustomizations item='customization' name=products} {assign var='quantityDisplayed' value=0}
{if $customization.product_id == $product.product_id} {foreach from=$returnedCustomizations item='customization' name=products}
<tr class="{if $smarty.foreach.products.first}first_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if}"> {if $customization.product_id == $product.product_id}
<td>{if $customization.reference}{$customization.reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td> <tr class="{if $smarty.foreach.products.first}first_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if}">
<td class="bold">{$customization.name|escape:'htmlall':'UTF-8'}</td> <td>{if $customization.reference}{$customization.reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td>
<td><span class="order_qte_span editable">{$customization.product_quantity|intval}</span></td> <td class="bold">{$customization.name|escape:'htmlall':'UTF-8'}</td>
</tr> <td><span class="order_qte_span editable">{$customization.product_quantity|intval}</span></td>
{assign var='productId' value=$customization.product_id}
{assign var='productAttributeId' value=$customization.product_attribute_id}
{assign var='customizationId' value=$customization.id_customization}
{foreach from=$customizedDatas.$productId.$productAttributeId.$customizationId.datas key='type' item='datas'}
<tr class="alternate_item">
<td colspan="3">
{if $type == $smarty.const._CUSTOMIZE_FILE_}
<ul class="customizationUploaded">
{foreach from=$datas item='data'}
<li>WAHOU<img src="{$pic_dir}{$data.value}_small" alt="" class="customizationUploaded" /></li>
{/foreach}
</ul>
{elseif $type == $smarty.const._CUSTOMIZE_TEXTFIELD_}
<ul class="typedText">{counter start=0 print=false}
{foreach from=$datas item='data'}
{assign var='customizationFieldName' value="Text #"|cat:$data.id_customization_field}
<li>{$data.name|default:$customizationFieldName}{l s=':'} {$data.value}</li>
{/foreach}
</ul>
{/if}
</td>
</tr> </tr>
{/foreach} {assign var='productId' value=$customization.product_id}
{assign var='quantityDisplayed' value=$quantityDisplayed+$customization.product_quantity} {assign var='productAttributeId' value=$customization.product_attribute_id}
{assign var='customizationId' value=$customization.id_customization}
{foreach from=$customizedDatas.$productId.$productAttributeId.$customizationId.datas key='type' item='datas'}
<tr class="alternate_item">
<td colspan="3">
{if $type == $smarty.const._CUSTOMIZE_FILE_}
<ul class="customizationUploaded">
{foreach from=$datas item='data'}
<li>WAHOU<img src="{$pic_dir}{$data.value}_small" alt="" class="customizationUploaded" /></li>
{/foreach}
</ul>
{elseif $type == $smarty.const._CUSTOMIZE_TEXTFIELD_}
<ul class="typedText">{counter start=0 print=false}
{foreach from=$datas item='data'}
{assign var='customizationFieldName' value="Text #"|cat:$data.id_customization_field}
<li>{$data.name|default:$customizationFieldName}{l s=':'} {$data.value}</li>
{/foreach}
</ul>
{/if}
</td>
</tr>
{/foreach}
{assign var='quantityDisplayed' value=$quantityDisplayed+$customization.product_quantity}
{/if}
{/foreach}
{if $product.product_quantity > $quantityDisplayed}
<tr class="{if $smarty.foreach.products.first}first_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if}">
<td>{if $product.product_reference}{$product.product_reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td>
<td class="bold">{$product.product_name|escape:'htmlall':'UTF-8'}</td>
<td><span class="order_qte_span editable">{$product.product_quantity|intval}</span></td>
</tr>
{/if} {/if}
{/foreach} {/foreach}
</tbody>
{if $product.product_quantity > $quantityDisplayed} </table>
<tr class="{if $smarty.foreach.products.first}first_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if}"> </div>
<td>{if $product.product_reference}{$product.product_reference|escape:'htmlall':'UTF-8'}{else}--{/if}</td> {if $orderRet->state == 2}
<td class="bold">{$product.product_name|escape:'htmlall':'UTF-8'}</td> <p class="bold">{l s='REMINDER:'}</p>
<td><span class="order_qte_span editable">{$product.product_quantity|intval}</span></td> <div>
</tr> - {l s='All products must be returned in their original packaging without damage or wear.'}
{/if} <br />- {l s='Please print out the'} <a href="{$link->getPageLink('pdf-order-return', true, NULL, "id_order_return={$orderRet->id|intval}")}">{l s='PDF document'}</a> {l s='and slip it into your package.'}
{/foreach} <br />- {l s='Please see PDF document'} (<a href="{$link->getPageLink('pdf-order-return', true, NULL, "id_order_return={$orderRet->id|intval}")}">{l s='for the correct address'}</a>)
</tbody> <br /><br />
</table> {l s='Upon receiving your package, you will be notified by e-mail. We will then begin processing the reimbursement of your order total.'}
</div> <br /><br /><a href="{$link->getPageLink('contact', true)}">{l s='Let us know if you have any questions.'}</a>
{if $orderRet->state == 2} <br />
<p class="bold">{l s='REMINDER:'}</p> <p class="bold">{l s='If the conditions of return listed above are not respected, we reserve the right to refuse your package and/or reimbursement.'}</p>
<div> </div>
- {l s='All products must be returned in their original packaging without damage or wear.'} {elseif $orderRet->state == 1}
<br />- {l s='Please print out the'} <a href="{$link->getPageLink('pdf-order-return', true, NULL, "id_order_return={$orderRet->id|intval}")}">{l s='PDF document'}</a> {l s='and slip it into your package.'} <p class="bold">{l s='You must wait for our confirmation before returning any merchandise.'}</p>
<br />- {l s='Please see PDF document'} (<a href="{$link->getPageLink('pdf-order-return', true, NULL, "id_order_return={$orderRet->id|intval}")}">{l s='for the correct address'}</a>) {/if}
<br /><br /> {/if}
{l s='Upon receiving your package, you will be notified by e-mail. We will then begin processing the reimbursement of your order total.'}
<br /><br /><a href="{$link->getPageLink('contact', true)}">{l s='Let us know if you have any questions.'}</a>
<br />
<p class="bold">{l s='If the conditions of return listed above are not respected, we reserve the right to refuse your package and/or reimbursement.'}</p>
</div>
{elseif $orderRet->state == 1}
<p class="bold">{l s='You must wait for our confirmation before returning any merchandise.'}</p>
{/if}