Ajout dans la facture du détail de livraison, pour PointRetrait et ClickAndCollect
This commit is contained in:
@@ -27,6 +27,11 @@
|
||||
<tag name="hook.event_listener" event="email-html.order-confirmation.delivery-address" type="email" method="displayDeliveryDateWithinEmail" />
|
||||
<tag name="hook.event_listener" event="email-html.order-notification.before-products" type="email" method="displayCompleteInformationWithinEmail" />
|
||||
</hook>
|
||||
|
||||
<hook id="cnc.pdf.hookmanager" class="ClickAndCollect\Hook\PdfHook">
|
||||
<tag name="hook.event_listener" event="invoice.after-delivery-module" type="pdf" method="displayDeliveryDateWithinPdf" />
|
||||
</hook>
|
||||
|
||||
</hooks>
|
||||
|
||||
<forms>
|
||||
|
||||
52
local/modules/ClickAndCollect/Hook/PdfHook.php
Normal file
52
local/modules/ClickAndCollect/Hook/PdfHook.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace ClickAndCollect\Hook;
|
||||
|
||||
use ClickAndCollect\ClickAndCollect;
|
||||
use PlanificationLivraison\Model\OrderDeliveryScheduleQuery;
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
|
||||
class PdfHook extends BaseHook
|
||||
{
|
||||
public function displayDeliveryDateWithinPdf(HookRenderEvent $event)
|
||||
{
|
||||
$orderId = $event->getArgument('order');
|
||||
$moduleId = OrderQuery::create()->findOneById($orderId)->getDeliveryModuleId();
|
||||
|
||||
if ((null !== $orderId) && $moduleId === ClickAndCollect::getModuleId()) {
|
||||
|
||||
$order = OrderDeliveryScheduleQuery::create()->findOneByOrderId($orderId);
|
||||
if (null !== $order) {
|
||||
$selectedDay = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_DATES);
|
||||
$beginTime = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_HEURE);
|
||||
$endTime = $order->getDueDeliveryTimeEnd(PlanificationLivraison::FORMAT_HEURE);
|
||||
$placeID = $order->getDeliveryPlaceId();
|
||||
$place = PdrPlacesQuery::create()->findOneById($placeID);
|
||||
|
||||
if ((null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime)) {
|
||||
$event->add(
|
||||
$this->render(
|
||||
'delivery-address.html', [
|
||||
'day' => $selectedDay,
|
||||
'begin_time' => $beginTime,
|
||||
'end_time' => $endTime,
|
||||
'title' => $place->getTitle(),
|
||||
'address1' => $place->getAddress1(),
|
||||
'address2' => $place->getAddress2(),
|
||||
'zipcode' => $place->getZipcode(),
|
||||
'city' => $place->getCity()
|
||||
])
|
||||
);
|
||||
} else
|
||||
throw new TheliaProcessException("ClickAndCollect : Impossible de récupérer les données");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,8 @@ return array(
|
||||
'There is no order to deliver' => 'Aucune commande à déposer',
|
||||
'There is no schedule for this place' => 'Aucun jour d\'ouverture pour ce point click and Collect',
|
||||
'Title of config view' => 'Point Click and Collect - Configuration',
|
||||
'Withdrawal address' => 'Retrait à l\'adresse suivante : ',
|
||||
'Withdrawal date' => 'A retirer à partir du : ',
|
||||
'Working day' => 'Jour d\'ouverture',
|
||||
'Zipcode' => 'Code postal',
|
||||
'' => '',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="panel panel-default col-sm-6">
|
||||
<div>
|
||||
<p><span>{intl l="Withdrawal date" d="clickandcollect"}<strong>{$day}</strong></span></p>
|
||||
<p><span><strong>{intl l="Withdrawal address" d="clickandcollect"}</strong><br>
|
||||
{$title}<br>
|
||||
{$address1}<br>
|
||||
{$address2}<br>
|
||||
{$zipcode} {$city}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,6 +28,10 @@
|
||||
<tag name="hook.event_listener" event="email-html.order-notification.before-products" type="email" method="displayCompleteInformationWithinEmail" />
|
||||
</hook>
|
||||
|
||||
<hook id="pdr.pdf.hookmanager" class="PointRetrait\Hook\PdfHook">
|
||||
<tag name="hook.event_listener" event="invoice.after-delivery-module" type="pdf" method="displayDeliveryDateWithinPdf" />
|
||||
</hook>
|
||||
|
||||
</hooks>
|
||||
|
||||
<loops>
|
||||
|
||||
52
local/modules/PointRetrait/Hook/PdfHook.php
Normal file
52
local/modules/PointRetrait/Hook/PdfHook.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Hook;
|
||||
|
||||
use PlanificationLivraison\Model\OrderDeliveryScheduleQuery;
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
|
||||
class PdfHook extends BaseHook
|
||||
{
|
||||
public function displayDeliveryDateWithinPdf(HookRenderEvent $event)
|
||||
{
|
||||
$orderId = $event->getArgument('order');
|
||||
$moduleId = OrderQuery::create()->findOneById($orderId)->getDeliveryModuleId();
|
||||
|
||||
if ((null !== $orderId) && $moduleId === PointRetrait::getModuleId()) {
|
||||
|
||||
$order = OrderDeliveryScheduleQuery::create()->findOneByOrderId($orderId);
|
||||
if (null !== $order) {
|
||||
$selectedDay = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_DATES);
|
||||
$beginTime = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_HEURE);
|
||||
$endTime = $order->getDueDeliveryTimeEnd(PlanificationLivraison::FORMAT_HEURE);
|
||||
$placeID = $order->getDeliveryPlaceId();
|
||||
$place = PdrPlacesQuery::create()->findOneById($placeID);
|
||||
|
||||
if ((null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime)) {
|
||||
$event->add(
|
||||
$this->render(
|
||||
'delivery-address.html', [
|
||||
'day' => $selectedDay,
|
||||
'begin_time' => $beginTime,
|
||||
'end_time' => $endTime,
|
||||
'title' => $place->getTitle(),
|
||||
'address1' => $place->getAddress1(),
|
||||
'address2' => $place->getAddress2(),
|
||||
'zipcode' => $place->getZipcode(),
|
||||
'city' => $place->getCity()
|
||||
])
|
||||
);
|
||||
} else
|
||||
throw new TheliaProcessException("PointRetrait : Impossible de récupérer les données");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,6 +47,8 @@ return array(
|
||||
'Withdrawal days' => 'Jours de retrait',
|
||||
'Withdrawal ending time' => 'Fin du retrait',
|
||||
'Withdrawal price' => 'Coût du retrait',
|
||||
'Withdrawal address' => 'Retrait à l\'adresse suivante : ',
|
||||
'Withdrawal date' => 'A retirer le : ',
|
||||
'Zipcode' => 'Code postal',
|
||||
'' => '',
|
||||
);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="panel panel-default col-sm-6">
|
||||
<div>
|
||||
<p><span>{intl l="Withdrawal date" d="pointretrait"}<strong>{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}</strong></span></p>
|
||||
<p><span><strong>{intl l="Withdrawal address" d="pointretrait"}</strong><br>
|
||||
{$title}<br>
|
||||
{$address1}<br>
|
||||
{$address2}<br>
|
||||
{$zipcode} {$city}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user