diff --git a/README.md b/README.md index 6ea7128..0871b14 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,57 @@ A companion module for thecheckout. Adds gift wrapping options when a user wants This module requires thecheckout module to be installed. -Todo: Make the module more portable when it comes to mail and PDF templates. Right now you have to manually add {ws_gift_paper_choice} to the mail templates +Todo: +1.) Make the module more portable when it comes to mail and PDF templates. Right now you have to manually add {ws_gift_paper_choice} to the mail templates + +`order_conf.html:` + +```html + + +
+ Cadeaupapier + {ws_gift_paper_choice} +
+ + +``` + +2.) Make the module more portable when it comes to adding the radio buttons in the checkout. Right now we have to manually add to the tpl: `themes/falcon/modules/thecheckout/views/templates/front/blocks/shipping.tpl` + +```smarty +{if isset($gift_paper_options) && $gift_paper_options|count} +
+ {l s='Kies je cadeaupapier' d='Admin.Modules.ws_giftdropdown'} +
+ {foreach from=$gift_paper_options item=option} + + {/foreach} +
+
+{/if} +``` + +3.) Make this translatable in displayHooks.php + +``` + if ($paperChoice) { + $note = 'Cadeaupapier: ' . $paperChoice; + $order->note = $order->note ? $order->note . "\n" . $note : $note; + $order->update(); + } + +``` + +4.) Instead of mod='ws_giftdropdown' say d='Admin.Modules.ws_giftdropdown' + +5.) Make paper choice an entity diff --git a/src/Config/Config.php b/src/Config/Config.php index ae3a462..767401c 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -6,7 +6,7 @@ class Config { const HOOKS = [ 'actionGetExtraMailTemplateVars', - 'actionValidateOrder', + 'actionValidateOrderAfter', 'actionFrontControllerSetMedia', 'displayAdminOrderMainBottom', 'displayHeader', diff --git a/src/Module/DisplayHooks.php b/src/Module/DisplayHooks.php index 901fa4a..e84a80e 100644 --- a/src/Module/DisplayHooks.php +++ b/src/Module/DisplayHooks.php @@ -22,7 +22,6 @@ trait DisplayHooks $this->context->smarty->assign('gift_paper_options', $options); - return $this->display(__FILE__, 'views/templates/hook/your_template.tpl'); } public function hookActionGetExtraMailTemplateVars(array $params): void @@ -35,7 +34,7 @@ trait DisplayHooks $params['extra_template_vars']['{ws_gift_paper_choice}'] = $paperChoice; } - public function hookActionValidateOrder(array $params) + public function hookActionValidateOrderAfter(array $params) { /** @var Order $order */ $order = $params['order'];