//ModuleController+MyAccountController+NewProductsController+OrderConfirmationController : Refacto done
This commit is contained in:
@@ -33,6 +33,10 @@
|
|||||||
*/
|
*/
|
||||||
class ModuleControllerCore extends FrontController
|
class ModuleControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Assign template vars related to page content
|
||||||
|
* @see FrontController::process()
|
||||||
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
// Check module existence
|
// Check module existence
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ class MyAccountControllerCore extends FrontController
|
|||||||
$this->addCSS(_THEME_CSS_DIR_.'my-account.css');
|
$this->addCSS(_THEME_CSS_DIR_.'my-account.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign template vars related to page content
|
||||||
|
* @see FrontController::process()
|
||||||
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
|
|||||||
@@ -35,11 +35,15 @@ class NewProductsControllerCore extends FrontController
|
|||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign template vars related to page content
|
||||||
|
* @see FrontController::process()
|
||||||
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
|
|
||||||
$nbProducts = (int)Product::getNewProducts($this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : NULL), (isset($this->n) ? (int)($this->n) : NULL), true);
|
$nbProducts = (int)Product::getNewProducts($this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : null), (isset($this->n) ? (int)($this->n) : null), true);
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ class OrderConfirmationControllerCore extends FrontController
|
|||||||
public $id_order;
|
public $id_order;
|
||||||
public $secure_key;
|
public $secure_key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize order confirmation controller
|
||||||
|
* @see FrontController::init()
|
||||||
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
@@ -49,17 +53,21 @@ class OrderConfirmationControllerCore extends FrontController
|
|||||||
$this->id_module = (int)(Tools::getValue('id_module', 0));
|
$this->id_module = (int)(Tools::getValue('id_module', 0));
|
||||||
$this->id_order = Order::getOrderByCartId((int)($this->id_cart));
|
$this->id_order = Order::getOrderByCartId((int)($this->id_cart));
|
||||||
$this->secure_key = Tools::getValue('key', false);
|
$this->secure_key = Tools::getValue('key', false);
|
||||||
if (!$this->id_order OR !$this->id_module OR !$this->secure_key OR empty($this->secure_key))
|
if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key))
|
||||||
Tools::redirect($redirectLink.(Tools::isSubmit('slowvalidation') ? '&slowvalidation' : ''));
|
Tools::redirect($redirectLink.(Tools::isSubmit('slowvalidation') ? '&slowvalidation' : ''));
|
||||||
|
|
||||||
$order = new Order((int)($this->id_order));
|
$order = new Order((int)($this->id_order));
|
||||||
if (!Validate::isLoadedObject($order) OR $order->id_customer != $this->context->customer->id OR $this->secure_key != $order->secure_key)
|
if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key)
|
||||||
Tools::redirect($redirectLink);
|
Tools::redirect($redirectLink);
|
||||||
$module = Module::getInstanceById((int)($this->id_module));
|
$module = Module::getInstanceById((int)($this->id_module));
|
||||||
if ($order->payment != $module->displayName)
|
if ($order->payment != $module->displayName)
|
||||||
Tools::redirect($redirectLink);
|
Tools::redirect($redirectLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign template vars related to page content
|
||||||
|
* @see FrontController::process()
|
||||||
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
|
|||||||
Reference in New Issue
Block a user