From baa1fb372c7ba32d1e577f24b421830c70f84971 Mon Sep 17 00:00:00 2001 From: Tomas Date: Sun, 26 Nov 2023 21:35:07 +0200 Subject: [PATCH] loaded web component code --- prestashopdevcon.php | 14 ++++++++++++-- views/templates/header.tpl | 1 + views/templates/home.tpl | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 views/templates/header.tpl create mode 100644 views/templates/home.tpl diff --git a/prestashopdevcon.php b/prestashopdevcon.php index 3ae1bc9..b908446 100755 --- a/prestashopdevcon.php +++ b/prestashopdevcon.php @@ -19,7 +19,8 @@ public function install() && $this->registerHook('displayHome') && $this->registerHook('displayCheckoutSummaryTop') && $this->registerHook('actionDispatcherBefore') - && $this->registerHook('displayShoppingCartFooter'); + && $this->registerHook('displayShoppingCartFooter') + && $this->registerHook('header'); } public function get($serviceName) @@ -27,6 +28,13 @@ public function get($serviceName) return (new ServiceProvider())->getService($serviceName); } + public function hookHeader() + { + return $this->context->smarty->fetch( + "{$this->getLocalPath()}/views/templates/header.tpl" + ); + } + public function hookActionDispatcherBefore() { include_once _PS_MODULE_DIR_ . $this->name . '/' . "vendor/autoload.php"; @@ -36,7 +44,9 @@ public function hookActionDispatcherBefore() public function hookDisplayHome() { - return "Hello from {$this->name}!"; + return $this->context->smarty->fetch( + "{$this->getLocalPath()}/views/templates/home.tpl" + ); } public function hookDisplayCheckoutSummaryTop() diff --git a/views/templates/header.tpl b/views/templates/header.tpl new file mode 100644 index 0000000..fac43a1 --- /dev/null +++ b/views/templates/header.tpl @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/views/templates/home.tpl b/views/templates/home.tpl new file mode 100644 index 0000000..d1efa32 --- /dev/null +++ b/views/templates/home.tpl @@ -0,0 +1,3 @@ + + This button is loaded using web components. Your number is: + \ No newline at end of file