// Refactoring of Hook class

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11998 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-01-02 14:42:05 +00:00
parent d56b86297c
commit 50e4dff4e5
8 changed files with 457 additions and 319 deletions
@@ -474,7 +474,10 @@ class AdminCarriersControllerCore extends AdminController
if (Validate::isLoadedObject($object_new))
{
$this->afterDelete($object_new, $object->id);
Hook::updateCarrier((int)$object->id, $object_new);
Hook::exec('actionCarrierUpdate', array(
'id_carrier' => (int)$object->id,
'carrier' => $object_new,
));
}
$this->changeGroups($object_new->id);
if (!$result)
@@ -72,8 +72,8 @@ class OrderConfirmationControllerCore extends FrontController
{
$this->context->smarty->assign(array(
'is_guest' => $this->context->customer->is_guest,
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int)($this->id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int)($this->id_order), (int)($this->id_module))
'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn()
));
if ($this->context->customer->is_guest)
@@ -89,5 +89,55 @@ class OrderConfirmationControllerCore extends FrontController
$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
parent::initContent();
}
/**
* Execute the hook displayPaymentReturn
*/
public function displayPaymentReturn()
{
if (Validate::isUnsignedId($this->id_order) && Validate::isUnsignedId($this->id_module))
{
$params = array();
$order = new Order($this->id_order);
$currency = new Currency($order->id_currency);
if (Validate::isLoadedObject($order))
{
$cart = new Cart((int)$order->id_cart);
$params['total_to_pay'] = $cart->getOrderTotal();
$params['currency'] = $currency->sign;
$params['objOrder'] = $order;
$params['currencyObj'] = $currency;
return Hook::exec('displayPaymentReturn', $params, $this->id_module);
}
}
return false;
}
/**
* Execute the hook displayOrderConfirmation
*/
public function displayOrderConfirmation()
{
if (Validate::isUnsignedId($this->id_order))
{
$params = array();
$order = new Order($this->id_order);
$currency = new Currency($order->id_currency);
if (Validate::isLoadedObject($order))
{
$cart = new Cart($order->id_cart);
$params['total_to_pay'] = $cart->getOrderTotal();
$params['currency'] = $currency->sign;
$params['objOrder'] = $order;
$params['currencyObj'] = $currency;
return Hook::exec('displayOrderConfirmation', $params);
}
}
return false;
}
}
+1 -1
View File
@@ -295,7 +295,7 @@ class OrderControllerCore extends ParentOrderController
global $orderTotal;
// Redirect instead of displaying payment modules if any module are grefted on
Hook::backBeforePayment('order.php?step=3');
Hook::exec('displayBeforePayment', array('module' => 'order.php?step=3'));
/* We may need to display an order summary */
$this->context->smarty->assign($this->context->cart->getSummaryDetails());