local/modules/FairDelivery/Hook/MailHook.php line 11
<?php
namespace FairDelivery\Hook;
use FairDelivery\Model\FairDeliveryQuery;
use HookFetes\Model\AgendaFetesQuery;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
class MailHook extends BaseHook
{
public function onEmailHtmlOrderConfirmationBeforProducts(HookRenderEvent $event){
$orderId = $event->getArgument('order');
$currentFair = FairDeliveryQuery::create()->findOneByOrderId(intval($orderId));
if(is_null($currentFair)) return;
$currentFairId = $currentFair->getAgendaFetesId();
$fairTitle = AgendaFetesQuery::create()->findOneByFetesId($currentFairId)->getTitle();
$html = "<div>".$fairTitle."</div>";
$event->add($html);
}
public static function getSubscribedHooks():array
{
return [
"email-html.order-confirmation.before-products" => [
[
"type" => "email",
"method" => "onEmailHtmlOrderConfirmationBeforProducts"
]
]
];
}
}