diff --git a/local/modules/LivraisonParSecteurs/Config/config.xml b/local/modules/LivraisonParSecteurs/Config/config.xml index 816f76df..829d4782 100644 --- a/local/modules/LivraisonParSecteurs/Config/config.xml +++ b/local/modules/LivraisonParSecteurs/Config/config.xml @@ -27,6 +27,10 @@ + + + + diff --git a/local/modules/LivraisonParSecteurs/Hook/EmailHook.php b/local/modules/LivraisonParSecteurs/Hook/EmailHook.php new file mode 100644 index 00000000..d63b10ce --- /dev/null +++ b/local/modules/LivraisonParSecteurs/Hook/EmailHook.php @@ -0,0 +1,40 @@ +getArgument('module'); + $orderId = $event->getArgument('order'); + + if ((null !== $orderId) && ($moduleId == LivraisonParSecteurs::getModuleId())) + { + $selectedDay = $this->getSession()->get(LivraisonParSecteurs::LPS_DELIVERY_DATE); + $beginTime = $this->getSession()->get(LivraisonParSecteurs::LPS_DELIVERY_BEGIN_TIME); + $endTime = $this->getSession()->get(LivraisonParSecteurs::LPS_DELIVERY_END_TIME); + + if ( (null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime) ) + { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime + ]) + ); + } + } + } + +} + + diff --git a/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html b/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html new file mode 100644 index 00000000..e55fb76f --- /dev/null +++ b/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html @@ -0,0 +1,6 @@ +
+
{intl l="Delivery day" d="livraisonparsecteurs"}
+
+ {$day} entre {format_date date=$begin_time format="H:i"} et {format_date date=$end_time format="H:i"} +
+
diff --git a/local/modules/PlanificationLivraison/EventListeners/DeliveryListener.php b/local/modules/PlanificationLivraison/EventListeners/DeliveryListener.php index 50eeb44f..7c7caa2b 100644 --- a/local/modules/PlanificationLivraison/EventListeners/DeliveryListener.php +++ b/local/modules/PlanificationLivraison/EventListeners/DeliveryListener.php @@ -89,7 +89,7 @@ class DeliveryListener extends BaseAction implements EventSubscriberInterface try { $query->setOrderId($orderId); $query->setScheduleId($scheduleId); - $query->setDeliveryAddressId($session->get('choosenDeliveryAddress')); + $query->setDeliveryAddressId($session->get(LivraisonParSecteurs::LPS_CHOSEN_ADDRESS)); $schedule = LpsAreaScheduleQuery::create()->findOneById($scheduleId); $chosenDate = LivraisonParSecteurs::calculateRelativeDate($schedule->getDay()); @@ -103,10 +103,9 @@ class DeliveryListener extends BaseAction implements EventSubscriberInterface $query->save($con); $con->commit(); } - catch (ProcessFileException $e) { - throw new TheliaProcessException("PlanificationLivraison : Impossible to record this schedule"); - } - + catch (\Exception $e) { + throw new TheliaProcessException("PlanificationLivraison : Impossible to record this schedule - Cause : " . $e->getMessage()); + } } } diff --git a/templates/email/custom/email-layout.tpl b/templates/email/custom/email-layout.tpl new file mode 100644 index 00000000..46a4317c --- /dev/null +++ b/templates/email/custom/email-layout.tpl @@ -0,0 +1,463 @@ +{default_translation_domain domain='email.default'} +{default_locale locale={$locale}} +{declare_assets directory='assets'} +{assign var="url_site" value="{config key="url_site"}"} +{assign var="company_name" value="{config key="store_name"}"} +{if not $company_name} + {assign var="company_name" value="{intl l='Thelia V2'}"} +{/if} + + + + + +{block name="email-subject"}{/block} + + +{hook name="email-html.layout.css"} + + +
+ + + + +
+ + {block name="pre-header"} + + + + {/block} + + {block name="logo-header"} + {/block} + + + + + + +
+ + + + +
+ + + + + + +
+ {block name="email-intro"}{/block} + + {block name="browser"}{intl l="Email not displaying correctly?"}
{intl l="View it in your browser"}.{/block} +
+
+
+ + + + +
+ + + + + + + +
+ + + + +
+ {block name="email-title"}{/block} +
+
+ + {block name="image-header"} + + + + {/block} + + + +
+ {local_media type="banner"} + + {/local_media} +
+ {block name="email-content"}{/block} +
+
+
+
+ + + + +
+ {hook name="email-html.layout.footer"} + {elsehook rel="email-html.layout.footer"} + + + + +
+ {intl l="Our mailing address is:"} +
+ {config key="store_address1"} {config key="store_address2"} {config key="store_address3"}
+ {config key="store_zipcode"} {config key="store_city"}, + {if {config key="store_country"} } + {loop type="country" name="address.country.title" id={config key="store_country"}}, {$TITLE}{/loop} + {/if} +
+
+ {intl l="Copyright"} © {'Y'|date} {$company_name}, {intl l="All rights reserved."} +
+ {/elsehook} +
+
+
+
+ + diff --git a/templates/email/custom/order_confirmation.html b/templates/email/custom/order_confirmation.html new file mode 100644 index 00000000..a47dfcc0 --- /dev/null +++ b/templates/email/custom/order_confirmation.html @@ -0,0 +1,142 @@ +{extends file="email-layout.tpl"} + +{* Do not provide a "Open in browser" link *} +{block name="browser"}{/block} +{* No pre-header *} +{block name="pre-header"}{/block} + +{* Subject *} +{block name="email-subject"}{intl l="Your order confirmation Nº %ref" ref={$order_ref}}{/block} + +{* Title *} +{block name="email-title"}{intl l="Thank you for your order!"}{/block} + +{* Content *} +{block name="email-content"} + + {loop name="order.invoice" type="order" id=$order_id customer="*"} + {loop name="currency.order" type="currency" id=$CURRENCY} + {assign var="orderCurrencyIsoCode" value=$ISOCODE} + {/loop} + {loop type="customer" name="customer.invoice" id=$CUSTOMER current="0"} + {assign var="customerRef" value=$REF} + {/loop} + + {hook name="email-html.order-confirmation.before-address" order=$order_id} + + {intl l="Here are the details of your purchase:"}

+ + + + + + +
+ {intl l="Delivery address:"}
+ {format_address order_address=$DELIVERY_ADDRESS locale=$locale} + + {ifhook rel="email-html.order-confirmation.delivery-address"} + {hook name="email-html.order-confirmation.delivery-address" module={$DELIVERY_MODULE} order=$order_id} + {/ifhook} +
+ {intl l="Billing address:"}
+ {format_address order_address=$INVOICE_ADDRESS locale=$locale} +
+ + {hook name="email-html.order-confirmation.after-address" order=$order_id} + +
+ +

+ {intl l="Order Total:"} {format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}
+ {intl l="Order Number:"} {$REF}
+ {intl l="Paid With:"} {loop name="payment-module" type="module" id=$PAYMENT_MODULE}{$TITLE}{/loop}
+ {intl l="Purchase Date:"} {format_date date=$CREATE_DATE output="datetime"}
+ {intl l="Delivery method:"} {loop name="delivery-module" type="module" id=$DELIVERY_MODULE}{$TITLE}{/loop}{$}
+

+ + {hook name="email-html.order-confirmation.before-products" order=$order_id} + + + + + + + {$subtotal = 0} + {loop type="order_product" name="order-products" order=$ID} + {if $WAS_IN_PROMO == 1} + {assign "realPrice" $PROMO_PRICE} + {assign "realTax" $PROMO_PRICE_TAX} + {assign "realTaxedPrice" $TAXED_PROMO_PRICE} + {else} + {assign "realPrice" $PRICE} + {assign "realTax" $PRICE_TAX} + {assign "realTaxedPrice" $TAXED_PRICE} + {/if} + + + + + + {hook name="email-html.order-confirmation.order-product" order="{$order_id}" order_product="{$ID}"} + + {/loop} + + + + + {if $DISCOUNT > 0} + + + + + + + + + {/if} + + + + + + + + +
{intl l="What You Purchased"}{intl l="Price in"} {$orderCurrencyIsoCode}
+ {$TITLE} ({$REF}{if $REF != $PRODUCT_SALE_ELEMENTS_REF}, {$PRODUCT_SALE_ELEMENTS_REF}{/if}) + {ifloop rel="combinations"}
+ {loop type="order_product_attribute_combination" name="combinations" order_product=$ID} + * {$ATTRIBUTE_TITLE}: {$ATTRIBUTE_AVAILABILITY_TITLE} + {/loop} + {/ifloop} + {hook name="email-html.order-confirmation.product-list" order=$order_id order_product=$ID} +
+ {$QUANTITY} x {format_money number=$realTaxedPrice currency_id=$CURRENCY} + {$subtotal = $subtotal + $realTaxedPrice * $QUANTITY} +
{intl l="Subtotal"}{format_money number=$subtotal currency_id=$CURRENCY}
{intl l="Discount"}{format_money number=$DISCOUNT currency_id=$CURRENCY}
{intl l="Total"}{format_money number={$TOTAL_TAXED_AMOUNT - $POSTAGE} currency_id=$CURRENCY}
{intl l="Shipping:"}{format_money number=$POSTAGE currency_id=$CURRENCY}
{intl l="Order Total"}{format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}
+ {/loop} + + {hook name="email-html.order-confirmation.after-products" order=$order_id} + +
+ + {ifhook rel="email-html.order-confirmation.footer"} + {hook name="email-html.order-confirmation.footer" order=$order_id} + {/ifhook} + {elsehook rel="email-html.order-confirmation.footer"} +

{intl l="View this order in your account at %shop_name" shop_name={config key="store_name"}}

+ +
+ +

{intl l="Support"}

+ {intl l='For any questions, or concerns, feel free to contact %mail.' mail={config key="store_email"}}

+ {intl l="Our contact us at:"}
+ {config key="store_name"}
+ {config key="store_address1"}
+ {config key="store_zipcode"} {config key="store_city"}
+
+
+ {intl l="Thanks"}
+ {/elsehook} +{/block} diff --git a/templates/email/custom/order_notification.html b/templates/email/custom/order_notification.html new file mode 100644 index 00000000..03924212 --- /dev/null +++ b/templates/email/custom/order_notification.html @@ -0,0 +1,127 @@ +{extends file="email-layout.tpl"} + +{* Do not provide a "Open in browser" link *} +{block name="browser"}{/block} +{* No big image header *} +{block name="image-header"}{/block} +{* No logo header *} +{block name="logo-header"}{/block} +{* No pre-header *} +{block name="pre-header"}{/block} + +{* Subject *} +{block name="email-subject"}{intl l="New order placed on %store_name Nº %ref" ref={$order_ref} store_name={config key="store_name"}}{/block} + +{* Title *} +{block name="email-title"}{intl l="Hello, a new order has been placed."}{/block} + +{* Content *} +{block name="email-content"} + {loop name="order.invoice" type="order" id=$order_id customer="*"} + {loop name="currency.order" type="currency" id=$CURRENCY} + {assign var="orderCurrencyIsoCode" value=$ISOCODE} + {/loop} + + {loop type="customer" name="customer.invoice" id=$CUSTOMER current="0"} + {assign var="customerRef" value=$REF} + {/loop} + +

{intl l="View this order in your shop back-office."}

+ + {hook name="email-html.order-notification.before-address" order=$order_id} + + + + + + +
+ {intl l="Customer delivery address:"}
+ {format_address order_address=$DELIVERY_ADDRESS locale=$locale} + + {ifhook rel="email-html.order-notification.delivery-address"} + {hook name="email-html.order-notification.delivery-address" module={$DELIVERY_MODULE} order=$order_id} + {/ifhook} +
+ {intl l="Customer billing address:"}
+ {format_address order_address=$INVOICE_ADDRESS locale=$locale} +
+ + {hook name="email-html.order-notification.after-address" order=$order_id} + +

+ {intl l="Order Total:"} {format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}
+ {intl l="Order Number:"} {$REF}
+ {intl l="Paid With:"} {loop name="payment-module" type="module" id=$PAYMENT_MODULE}{$TITLE}{/loop}
+ {intl l="Purchase Date:"} {format_date date=$CREATE_DATE output="datetime"}
+ {intl l="Delivery method:"} {loop name="delivery-module" type="module" id=$DELIVERY_MODULE}{$TITLE}{/loop}
+

+ + {hook name="email-html.order-notification.before-products" order=$order_id} + + + + + + + {$subtotal = 0} + {loop type="order_product" name="order-products" order=$ID} + {if $WAS_IN_PROMO == 1} + {assign "realPrice" $PROMO_PRICE} + {assign "realTax" $PROMO_PRICE_TAX} + {assign "realTaxedPrice" $TAXED_PROMO_PRICE} + {else} + {assign "realPrice" $PRICE} + {assign "realTax" $PRICE_TAX} + {assign "realTaxedPrice" $TAXED_PRICE} + {/if} + + + + + + {hook name="email-html.order-notification.order-product" order={$order_id} order_product={$ID}} + + {/loop} + + + + + {if $DISCOUNT > 0} + + + + + + + + + {/if} + + + + + + + + + +
{intl l="What You Purchased"}{intl l="Price in"} {$orderCurrencyIsoCode}
+ {$TITLE} ({$REF}{if $REF != $PRODUCT_SALE_ELEMENTS_REF}, {$PRODUCT_SALE_ELEMENTS_REF}{/if}) + {ifloop rel="combinations"}
+ {loop type="order_product_attribute_combination" name="combinations" order_product=$ID} + * {$ATTRIBUTE_TITLE}: {$ATTRIBUTE_AVAILABILITY_TITLE} + {/loop} + {/ifloop} +
+ {$QUANTITY} x {format_money number=$realTaxedPrice currency_id=$CURRENCY} + {$subtotal = $subtotal + $realTaxedPrice * $QUANTITY} +
{intl l="Subtotal"}{format_money number=$subtotal currency_id=$CURRENCY}
{intl l="Discount"}{format_money number=$DISCOUNT currency_id=$CURRENCY}
{intl l="Total"}{format_money number={$TOTAL_TAXED_AMOUNT - $POSTAGE} currency_id=$CURRENCY}
{intl l="Shipping:"}{format_money number=$POSTAGE currency_id=$CURRENCY}
{intl l="Order Total"}{format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}
+ {/loop} + + {hook name="email-html.order-notification.after-products" order=$order_id} + +
+ + {intl l="Have a nice day."}
+{/block}