local/modules/MondialRelayPickupPoint/Hook/FrontHookManager.php line 39

  1. <?php
  2. /*************************************************************************************/
  3. /*      Copyright (c) Franck Allimant, CQFDev                                        */
  4. /*      email : thelia@cqfdev.fr                                                     */
  5. /*      web : http://www.cqfdev.fr                                                   */
  6. /*                                                                                   */
  7. /*      For the full copyright and license information, please view the LICENSE      */
  8. /*      file that was distributed with this source code.                             */
  9. /*************************************************************************************/
  10. namespace MondialRelayPickupPoint\Hook;
  11. use MondialRelayPickupPoint\MondialRelayPickupPoint;
  12. use Thelia\Core\Event\Hook\HookRenderEvent;
  13. use Thelia\Core\Hook\BaseHook;
  14. class FrontHookManager extends BaseHook
  15. {
  16.     public function onOrderDeliveryExtra(HookRenderEvent $event)
  17.     {
  18.         // Clear the session context
  19.         $this->getSession()->remove(MondialRelayPickupPoint::SESSION_SELECTED_DELIVERY_TYPE);
  20.         $this->getSession()->remove(MondialRelayPickupPoint::SESSION_SELECTED_PICKUP_RELAY_ID);
  21.         // Get the address id from the request, as the hook don(t give it to us.
  22.         $addressId $this->getRequest()->get('address_id'0);
  23.         $event->add(
  24.             $this->render(
  25.                 'mondialrelaypickuppoint/order-delivery-extra.html',
  26.                 [
  27.                     'module_id' => MondialRelayPickupPoint::getModuleId(),
  28.                     'address_id' => $addressId
  29.                 ]
  30.             )
  31.         );
  32.     }
  33.     public function onAccountOrderDeliveryAddress(HookRenderEvent $event)
  34.     {
  35.         $event->add(
  36.             $this->render(
  37.                 'mondialrelaypickuppoint/order-delivery-address.html',
  38.                 [
  39.                     'order_id' => $event->getArgument('order'),
  40.                     'module_id' => $event->getArgument('module')
  41.                 ]
  42.             )
  43.         );
  44.     }
  45. }