Commit du module Colissimo
This commit is contained in:
23
local/modules/SoColissimo/Hook/BackHook.php
Normal file
23
local/modules/SoColissimo/Hook/BackHook.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace SoColissimo\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* Class BackHook
|
||||
* @package SoColissimo\Hook
|
||||
*/
|
||||
class BackHook extends BaseHook
|
||||
{
|
||||
public function onModuleConfiguration(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('SoColissimo/module_configuration.html'));
|
||||
}
|
||||
|
||||
public function onModuleConfigJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('SoColissimo/module-config-js.html'));
|
||||
}
|
||||
}
|
||||
44
local/modules/SoColissimo/Hook/FrontHook.php
Normal file
44
local/modules/SoColissimo/Hook/FrontHook.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace SoColissimo\Hook;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
|
||||
/**
|
||||
* Class FrontHook
|
||||
* @package SoColissimo\Hook
|
||||
* @author Michaël Espeche <mespeche@openstudio.fr>
|
||||
*/
|
||||
class FrontHook extends BaseHook {
|
||||
|
||||
|
||||
|
||||
public function onOrderDeliveryExtra(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->render("socolissimo.html", $event->getArguments());
|
||||
$event->add($content);
|
||||
}
|
||||
|
||||
public function onOrderInvoiceDeliveryAddress(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->render("delivery-address.html", $event->getArguments());
|
||||
$event->add($content);
|
||||
}
|
||||
|
||||
public function onMainHeadBottom(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->addCSS('assets/css/styles.css');
|
||||
$event->add($content);
|
||||
}
|
||||
}
|
||||
38
local/modules/SoColissimo/Hook/PdfHook.php
Normal file
38
local/modules/SoColissimo/Hook/PdfHook.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace SoColissimo\Hook;
|
||||
|
||||
use SoColissimo\SoColissimo;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
class PdfHook extends BaseHook
|
||||
{
|
||||
public function onInvoiceAfterDeliveryModule(HookRenderEvent $event)
|
||||
{
|
||||
// No So Colissimo information if the delivery module is not SoColissimo
|
||||
if (SoColissimo::getModuleId() == $event->getArgument('module_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$order = OrderQuery::create()->findOneById($event->getArgument('order'));
|
||||
|
||||
if (!is_null($order)) {
|
||||
$event->add($this->render(
|
||||
'delivery_mode_infos.html',
|
||||
['delivery_address_id' => $order->getDeliveryOrderAddressId()]
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user