On this weblog, we’re going to learn to add electronic mail theme in PrestaShop utilizing module.
In PrestaShop you’ll be able to add new theme folder instantly in mail/themes, however this will’t be set up/uninstall shortly as module.
Firstly you must create your individual templates for mails as it’s given in mails/theme/ and maintain it in your module.
Comply with the identical folder construction as given under
├── modules ├── yourmodule ├── mails │ └── themes | └──wk_modern | ├assets---contains all belongings going to make use of | ├components---contains header, footer, format | | twig information | ├core---contains all of the mail templates accessible | | in PS as twig information | └modules --- comprises all of the modules associated | mails accessible in PS modules | | └── yourmodule.php
Right here, we’re going to use the hook actionListMailTheme which record new mail theme instantly from module. Please observe the under code for module foremost file.
<?php use PrestaShopPrestaShopCoreMailTemplateLayoutLayout; use PrestaShopPrestaShopCoreMailTemplateThemeCatalogInterface; use PrestaShopPrestaShopCoreMailTemplateThemeCollectionInterface; use PrestaShopPrestaShopCoreMailTemplateThemeInterface; use PrestaShopPrestaShopCoreMailTemplateFolderThemeScanner; class WkModern extends Module { public operate __construct() { $this->identify = 'WkModern'; $this->tab = 'theme'; $this->model = '1.0.0'; $this->creator = 'Writer'; $this->need_instance = 0; dad or mum::__construct(); $this->displayName = $this->l('Fashionable E-mail Theme'); $this->description = $this->l('E-mail theme module to modifiy emails.'); $this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_); } public operate set up() { return dad or mum::set up() && $this->registerHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate uninstall() { return dad or mum::uninstall() && $this->unregisterHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate allow($force_all = false) { return dad or mum::allow($force_all) && $this->registerHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate disable($force_all = false) { return dad or mum::disable($force_all) && $this->unregisterHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate hookActionListMailThemes(array $hookParams) { if (!isset($hookParams['mailThemes'])) { return; } /** @var ThemeCollectionInterface $themes */ $themes = $hookParams['mailThemes']; $scanner = new FolderThemeScanner(__DIR__); $wk_modern = $scanner->scan(__DIR__.'/mails/themes/wk_modern'); if (null !== $wk_modern && $wk_modern->getLayouts()->depend() > 0) { $themes->add($wk_modern); } } }
Your theme is listed in “Design > E-mail Theme” web page and preview the wk_modern theme, similar as default PrestaShop electronic mail theme is proven. You may click on on the view button and see all of the accessible electronic mail templates in that exact theme.
On this instance we have now created an electronic mail theme with identify wk_modern as proven in hooked up picture under .
That’s all about E-mail theme in PrestaShop utilizing module. Hope it is going to enable you to.
Concluding this weblog, I hope it proves useful to you. For those who encounter any points or have doubts in regards to the aforementioned course of, please don’t hesitate to contact us by way of the remark part.
Additionally, you’ll be able to discover our PrestaShop Improvement Providers and a wide range of high quality PrestaShop Modules.
For any doubt contact us at [email protected]
On this weblog, we’re going to learn to add electronic mail theme in PrestaShop utilizing module.
In PrestaShop you’ll be able to add new theme folder instantly in mail/themes, however this will’t be set up/uninstall shortly as module.
Firstly you must create your individual templates for mails as it’s given in mails/theme/ and maintain it in your module.
Comply with the identical folder construction as given under
├── modules ├── yourmodule ├── mails │ └── themes | └──wk_modern | ├assets---contains all belongings going to make use of | ├components---contains header, footer, format | | twig information | ├core---contains all of the mail templates accessible | | in PS as twig information | └modules --- comprises all of the modules associated | mails accessible in PS modules | | └── yourmodule.php
Right here, we’re going to use the hook actionListMailTheme which record new mail theme instantly from module. Please observe the under code for module foremost file.
<?php use PrestaShopPrestaShopCoreMailTemplateLayoutLayout; use PrestaShopPrestaShopCoreMailTemplateThemeCatalogInterface; use PrestaShopPrestaShopCoreMailTemplateThemeCollectionInterface; use PrestaShopPrestaShopCoreMailTemplateThemeInterface; use PrestaShopPrestaShopCoreMailTemplateFolderThemeScanner; class WkModern extends Module { public operate __construct() { $this->identify = 'WkModern'; $this->tab = 'theme'; $this->model = '1.0.0'; $this->creator = 'Writer'; $this->need_instance = 0; dad or mum::__construct(); $this->displayName = $this->l('Fashionable E-mail Theme'); $this->description = $this->l('E-mail theme module to modifiy emails.'); $this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_); } public operate set up() { return dad or mum::set up() && $this->registerHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate uninstall() { return dad or mum::uninstall() && $this->unregisterHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate allow($force_all = false) { return dad or mum::allow($force_all) && $this->registerHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate disable($force_all = false) { return dad or mum::disable($force_all) && $this->unregisterHook(ThemeCatalogInterface::LIST_MAIL_THEMES_HOOK); } public operate hookActionListMailThemes(array $hookParams) { if (!isset($hookParams['mailThemes'])) { return; } /** @var ThemeCollectionInterface $themes */ $themes = $hookParams['mailThemes']; $scanner = new FolderThemeScanner(__DIR__); $wk_modern = $scanner->scan(__DIR__.'/mails/themes/wk_modern'); if (null !== $wk_modern && $wk_modern->getLayouts()->depend() > 0) { $themes->add($wk_modern); } } }
Your theme is listed in “Design > E-mail Theme” web page and preview the wk_modern theme, similar as default PrestaShop electronic mail theme is proven. You may click on on the view button and see all of the accessible electronic mail templates in that exact theme.
On this instance we have now created an electronic mail theme with identify wk_modern as proven in hooked up picture under .
That’s all about E-mail theme in PrestaShop utilizing module. Hope it is going to enable you to.
Concluding this weblog, I hope it proves useful to you. For those who encounter any points or have doubts in regards to the aforementioned course of, please don’t hesitate to contact us by way of the remark part.
Additionally, you’ll be able to discover our PrestaShop Improvement Providers and a wide range of high quality PrestaShop Modules.
For any doubt contact us at [email protected]