From 5a9567804e58bd2c7a0939cdd3c3a0f3c509dc33 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 21 Feb 2023 09:41:42 +0100 Subject: [PATCH] Prestashop 2.0 --- README.md | 14 +- .../ecomailemailmarketing.php | 984 ++++++++++++++++++ ecomailemailmarketing/index.php | 31 + ecomailemailmarketing/lib/api.php | 240 +++++ ecomailemailmarketing/lib/index.php | 31 + ecomailemailmarketing/logo.png | Bin 0 -> 3484 bytes ecomailemailmarketing/override/index.php | 31 + .../override/modules/index.php | 31 + .../modules/ps_emailsubscription/index.php | 31 + .../ps_emailsubscription.php | 40 + ...ilmarketingEcomailemailmarketing.cs-CZ.xlf | 177 ++++ .../translations/cs-CZ/index.php | 28 + ecomailemailmarketing/translations/index.php | 28 + ecomailemailmarketing/views/index.php | 31 + .../views/templates/hook/ecomail_scripts.tpl | 60 ++ .../views/templates/hook/index.php | 31 + .../views/templates/index.php | 31 + ecomailemailmarketing/webhook.php | 44 + monster_ecomail/lib/api.php | 166 --- monster_ecomail/logo.png | Bin 6616 -> 0 bytes monster_ecomail/mm_logo.png | Bin 14752 -> 0 bytes monster_ecomail/monster_ecomail.php | 640 ------------ .../blocknewsletter/blocknewsletter.php | 21 - .../ps_emailsubscription.php | 53 - monster_ecomail/readme_1.5.html | 74 -- monster_ecomail/webhook.php | 27 - 26 files changed, 1856 insertions(+), 988 deletions(-) create mode 100644 ecomailemailmarketing/ecomailemailmarketing.php create mode 100644 ecomailemailmarketing/index.php create mode 100644 ecomailemailmarketing/lib/api.php create mode 100644 ecomailemailmarketing/lib/index.php create mode 100644 ecomailemailmarketing/logo.png create mode 100644 ecomailemailmarketing/override/index.php create mode 100644 ecomailemailmarketing/override/modules/index.php create mode 100644 ecomailemailmarketing/override/modules/ps_emailsubscription/index.php create mode 100644 ecomailemailmarketing/override/modules/ps_emailsubscription/ps_emailsubscription.php create mode 100644 ecomailemailmarketing/translations/cs-CZ/ModulesEcomailemailmarketingEcomailemailmarketing.cs-CZ.xlf create mode 100644 ecomailemailmarketing/translations/cs-CZ/index.php create mode 100644 ecomailemailmarketing/translations/index.php create mode 100644 ecomailemailmarketing/views/index.php create mode 100644 ecomailemailmarketing/views/templates/hook/ecomail_scripts.tpl create mode 100644 ecomailemailmarketing/views/templates/hook/index.php create mode 100644 ecomailemailmarketing/views/templates/index.php create mode 100644 ecomailemailmarketing/webhook.php delete mode 100644 monster_ecomail/lib/api.php delete mode 100644 monster_ecomail/logo.png delete mode 100644 monster_ecomail/mm_logo.png delete mode 100644 monster_ecomail/monster_ecomail.php delete mode 100644 monster_ecomail/override/modules/blocknewsletter/blocknewsletter.php delete mode 100644 monster_ecomail/override/modules/ps_emailsubscription/ps_emailsubscription.php delete mode 100644 monster_ecomail/readme_1.5.html delete mode 100644 monster_ecomail/webhook.php diff --git a/README.md b/README.md index 343e0b8..c36388e 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# Prestashop plugin 1.5-1.7 -Modul pro propojení Ecomail s Prestahopem 1.5 a 1.7 +# Prestashop 1.7+ plugin +Ecomail to Prestashop 1.7+ plugin -Tento modul automaticky synchronizuje vaše kontakty do vybraného seznamu u Ecomailu, objednávky a instaluje automaticky trackovací kód pro sledování chování kontaktů na vašich stránkách. +This plugin automatically synchronizes your contacts to a selected list at Ecomail, orders and installs automatically a tracking code to monitor the behavior of contacts on your site. -# Stáhnutí modulu +# Download module -Aktualní verzi modulu můžete stáhnout zde: +You can download the latest version of the module here: -https://github.com/Ecomailcz/Prestashop-1.6/releases/download/1.9.703/monster_ecomail_1.9.702.zip +https://github.com/Ecomailcz/Prestashop-1.6/releases/download/2.0.0/ecomail_2.0.0.zip -Nápovědu k použití modulu naleznete zde: +Help on how to use the module can be found here: https://support.ecomail.cz/hc/cs/articles/209707269-Prestashop-plugin-1-6 diff --git a/ecomailemailmarketing/ecomailemailmarketing.php b/ecomailemailmarketing/ecomailemailmarketing.php new file mode 100644 index 0000000..a2c2f0f --- /dev/null +++ b/ecomailemailmarketing/ecomailemailmarketing.php @@ -0,0 +1,984 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +class ecomailemailmarketing extends Module +{ + protected $overridenModules = ['Ps_Emailsubscription']; + + public function __construct() + { + $this->module_key = '3c90ebaffe6722aece11c7a66bc18bec'; + $this->name = 'ecomailemailmarketing'; + $this->tab = 'emailing'; + $this->version = '2.0.0'; + $this->author = 'Ecomail'; + $this->need_instance = 0; + $this->ps_versions_compliancy = ['min' => '1.7.0.0', 'max' => '8.0.1']; + $this->bootstrap = true; + + parent::__construct(); + + $this->displayName = $this->l('Ecomail email marketing'); + $this->description = $this->l('Connection of the e-shop to Ecomail.'); + + $this->confirmUninstall = $this->l('Do you really want to uninstall Ecomail?'); + } + + public function install(): bool + { + return parent::install() && + $this->setValues() && + $this->setTab() && + $this->setDatabase() && + $this->setHooks() && + $this->createWebserviceKey() && + unlink(_PS_CACHE_DIR_ . '/class_index.php'); + } + + public function uninstall(): bool + { + return parent::uninstall() && + $this->unsetValues() && + $this->unsetTab() && + $this->unsetDatabase(); + } + + // Config values + public function setValues(): bool + { + return + Configuration::updateValue('ECOMAIL_SKIP_CONFIRM', 1) && + Configuration::updateValue('PS_WEBSERVICE', 1) && + Configuration::updateValue('PS_WEBSERVICE_CGI_HOST', 1); + } + + public function unsetValues(): bool + { + return + Configuration::deleteByName('ECOMAIL_API_KEY') && + Configuration::deleteByName('ECOMAIL_APP_ID') && + Configuration::deleteByName('ECOMAIL_FORM_ID') && + Configuration::deleteByName('ECOMAIL_FORM_ACCOUNT') && + Configuration::deleteByName('ECOMAIL_WEBSERVICE_KEY') && + Configuration::deleteByName('ECOMAIL_LIST_ID'); + } + + // Admin tabs + public function setTab(): bool + { + return true; + } + + public function unsetTab(): bool + { + return true; + } + + // DB tables + public function setDatabase(): bool + { + return true; + } + + public function unsetDatabase(): bool + { + return true; + } + + // Hooks + public function setHooks(): bool + { + return + $this->registerHook('actionCustomerAccountAdd') && + $this->registerHook('actionValidateOrder') && + $this->registerHook('displayFooter') && + $this->registerHook('actionCustomerNewsletterSubscribed') && + $this->registerHook('actionCartSave') && + $this->registerHook('actionCustomerAccountUpdate') && + $this->registerHook('actionSubmitCustomerAddressForm') && + $this->registerHook('addWebserviceResources'); + } + + public function getContent(): string + { + $output = null; + + if (Tools::isSubmit('submit' . $this->name)) { + $apiKey = Configuration::get('ECOMAIL_API_KEY'); + Configuration::updateValue('ECOMAIL_API_KEY', Tools::getValue('api_key')); + + if (Tools::getValue('api_key') !== $apiKey) { + if (!$this->getAPI()->isApiKeyValid()) { + $output .= $this->displayError($this->l('Invalid API key')); + Configuration::deleteByName('ECOMAIL_API_KEY'); + } + } + + Configuration::updateValue('ECOMAIL_APP_ID', Tools::getValue('app_id')); + Configuration::updateValue('ECOMAIL_FORM_ID', Tools::getValue('form_id')); + Configuration::updateValue('ECOMAIL_FORM_ACCOUNT', Tools::getValue('form_account')); + + // Call initial sync + if ( + Tools::getValue('sync_existing') && + Configuration::get('ECOMAIL_API_KEY') && + ( + (Tools::getValue('sync_existing') !== Configuration::get('ECOMAIL_SYNC_EXISTING')) || + (Configuration::get('ECOMAIL_LIST_ID') !== Tools::getValue('list_id')) + ) + ) { + PrestaShopLogger::addLog('Sync customers and orders'); + $this->syncCustomers(Tools::getValue('list_id')); + $this->syncOrders(); + $output .= $this->displayConfirmation($this->l('Synchronisation of existing contacts and orders was successful.')); + } + + Configuration::updateValue('ECOMAIL_LIST_ID', Tools::getValue('list_id')); + Configuration::updateValue('ECOMAIL_LOAD_ORDER_DATA', Tools::getValue('load_order_data')); + Configuration::updateValue('ECOMAIL_LOAD_NAME', Tools::getValue('load_name')); + Configuration::updateValue('ECOMAIL_LOAD_ADDRESS', Tools::getValue('load_address')); + Configuration::updateValue('ECOMAIL_LOAD_BIRTHDAY', Tools::getValue('load_birthday')); + Configuration::updateValue('ECOMAIL_LOAD_CART', Tools::getValue('load_cart')); + Configuration::updateValue('ECOMAIL_SKIP_CONFIRM', Tools::getValue('skip_confirmation')); + Configuration::updateValue('ECOMAIL_SYNC_EXISTING', Tools::getValue('sync_existing')); + Configuration::updateValue('ECOMAIL_LOAD_GROUP', Tools::getValue('load_group')); + Configuration::updateValue('ECOMAIL_TRIGGER_AUTORESPONDERS', Tools::getValue('trigger_autoresponders')); + } + + if (Configuration::get('ECOMAIL_API_KEY') && !$this->getAPI()->getListsCollection()) { + $output .= $this->displayError($this->l('Unable to connect to Ecomail. Please check your API key.')); + } + + if (Configuration::get('ECOMAIL_API_KEY') && $this->getAPI()->getListsCollection()) { + $output .= $this->displayConfirmation($this->l('Connection to Ecomail is active.')); + $output .= $this->displayConfirmation($this->l('The webhook for updating contacts is at ') . '' . (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/modules/ecomailemailmarketing/webhook.php'); + } + + return $output . $this->displayForm(); + } + + public function displayForm(): string + { + // Get default language + $default_lang = (int) Configuration::get('PS_LANG_DEFAULT'); + + if (Configuration::get('ECOMAIL_API_KEY') && $this->getAPI()->getListsCollection()) { + $options = []; + if (Configuration::get('ECOMAIL_API_KEY')) { + $listsCollection = $this->getAPI() + ->getListsCollection(); + foreach ($listsCollection as $list) { + $options[] = [ + 'id_option' => $list->id, + 'name' => $list->name, + ]; + } + } + + // Init Fields form array + $fields_form[0]['form'] = [ + 'legend' => [ + 'title' => $this->l('Ecomail configuration'), + ], + 'input' => [ + [ + 'type' => 'text', + 'label' => $this->l('Enter your API key'), + 'name' => 'api_key', + 'rows' => 20, + 'required' => true, + ], + [ + 'type' => 'select', + 'label' => $this->l('Select a contact list:'), + 'desc' => $this->l( + 'Select the contact list in which the new customers will be synchronised. If you have only just created it, it may take up to 30 minutes to connect to it.' + ), + 'name' => 'list_id', + 'required' => true, + 'options' => [ + 'query' => $options, + 'id' => 'id_option', + 'name' => 'name', + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Update data based on order data'), + 'name' => 'load_order_data', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Send customer names'), + 'name' => 'load_name', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Send customer addresses'), + 'name' => 'load_address', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Send birthday of customers'), + 'name' => 'load_birthday', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Send products in cart'), + 'name' => 'load_cart', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Send customer groups to tags'), + 'name' => 'load_group', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Skip double opt-in'), + 'name' => 'skip_confirmation', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Trigger pipelines for new contacts'), + 'name' => 'trigger_autoresponders', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + [ + 'type' => 'switch', + 'class' => 't', + 'label' => $this->l('Synchronise existing contacts and orders (this operation may take a few minutes)'), + 'name' => 'sync_existing', + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('No'), + ], + ], + ], + ], + 'warning' => $this->l('Click the save button to start synchronizing the data. Wait for the page to reload.'), + 'submit' => [ + 'title' => $this->l('Save'), + 'class' => 'btn btn-default pull-right', + ], + ]; + + $fields_form[1]['form'] = [ + 'legend' => [ + 'title' => $this->l('Tracking'), + ], + 'input' => [ + [ + 'type' => 'text', + 'label' => $this->l('Enter your appId'), + 'desc' => $this->l( + 'This information is used to activate the tracking code and track transactions - only for the Marketer+ tariff' + ), + 'name' => 'app_id', + 'rows' => 20, + ], + ], + 'submit' => [ + 'title' => $this->l('Save'), + 'class' => 'btn btn-default pull-right', + ], + ]; + + $fields_form[2]['form'] = [ + 'legend' => [ + 'title' => $this->l('Sign-up form'), + ], + 'input' => [ + [ + 'type' => 'text', + 'label' => $this->l('Insert Ecomail Form ID'), + 'desc' => $this->l( + 'The js.id value in the form code. See the help for more information' + ), + 'name' => 'form_id', + 'rows' => 20, + ], + [ + 'type' => 'text', + 'label' => $this->l('Insert your Ecomail account name'), + 'name' => 'form_account', + 'rows' => 20, + ], + ], + 'submit' => [ + 'title' => $this->l('Save'), + 'class' => 'btn btn-default pull-right', + ], + ]; + } else { + $fields_form[0]['form'] = [ + 'legend' => [ + 'title' => $this->l('Ecomail configuration'), + ], + 'input' => [ + [ + 'type' => 'text', + 'label' => $this->l('Enter your API key'), + 'name' => 'api_key', + 'rows' => 20, + 'required' => true, + 'desc' => $this->l('Once your API key is loaded correctly, you will select a list of contacts for your e-shop.'), + ], + ], + 'submit' => [ + 'title' => $this->l('Save'), + 'class' => 'btn btn-default pull-right', + ], + ]; + } + + $helper = new HelperForm(); + + // Module, token and currentIndex + $helper->module = $this; + $helper->name_controller = $this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; + + // Language + $helper->default_form_language = $default_lang; + $helper->allow_employee_form_lang = $default_lang; + + // Title and toolbar + $helper->title = $this->displayName; + $helper->show_toolbar = true; + $helper->toolbar_scroll = true; + $helper->submit_action = 'submit' . $this->name; + $helper->toolbar_btn = [ + 'save' => [ + 'desc' => $this->l('Save'), + 'href' => AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . + '&token=' . Tools::getAdminTokenLite('AdminModules'), + ], + 'back' => [ + 'href' => AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules'), + 'desc' => $this->l('Back to list'), + ], + ]; + + // Load current value + $helper->fields_value['api_key'] = Configuration::get('ECOMAIL_API_KEY'); + $helper->fields_value['app_id'] = Configuration::get('ECOMAIL_APP_ID'); + $helper->fields_value['form_id'] = Configuration::get('ECOMAIL_FORM_ID'); + $helper->fields_value['form_account'] = Configuration::get('ECOMAIL_FORM_ACCOUNT'); + $helper->fields_value['list_id'] = Configuration::get('ECOMAIL_LIST_ID'); + $helper->fields_value['load_order_data'] = Configuration::get('ECOMAIL_LOAD_ORDER_DATA'); + + $helper->fields_value['load_name'] = Configuration::get('ECOMAIL_LOAD_NAME'); + $helper->fields_value['load_address'] = Configuration::get('ECOMAIL_LOAD_ADDRESS'); + $helper->fields_value['load_birthday'] = Configuration::get('ECOMAIL_LOAD_BIRTHDAY'); + $helper->fields_value['load_cart'] = Configuration::get('ECOMAIL_LOAD_CART'); + $helper->fields_value['skip_confirmation'] = Configuration::get('ECOMAIL_SKIP_CONFIRM'); + $helper->fields_value['sync_existing'] = Configuration::get('ECOMAIL_SYNC_EXISTING'); + $helper->fields_value['load_group'] = Configuration::get('ECOMAIL_LOAD_GROUP'); + $helper->fields_value['trigger_autoresponders'] = Configuration::get('ECOMAIL_TRIGGER_AUTORESPONDERS'); + + return $helper->generateForm($fields_form); + } + + protected function getAPI(): EcomailAPI + { + require_once __DIR__ . '/lib/api.php'; + + $obj = new EcomailAPI(); + $obj->setAPIKey(Configuration::get('ECOMAIL_API_KEY')); + + return $obj; + } + + // customer registration, cart registration, order without registration + public function hookActionCustomerAccountAdd(array $params): void + { + $newsletter = $params['newCustomer']->newsletter; + $email = $params['newCustomer']->email; + + if (Configuration::get('ECOMAIL_API_KEY')) { + $nameData = []; + $birthdayData = []; + + if (Configuration::get('ECOMAIL_LOAD_NAME')) { + $firstname = $params['newCustomer']->firstname; + $lastname = $params['newCustomer']->lastname; + + $nameData = [ + 'name' => $firstname, + 'surname' => $lastname, + ]; + } + + if (Configuration::get('ECOMAIL_LOAD_BIRTHDAY')) { + $birthdayData = [ + 'birthday' => $params['newCustomer']->birthday, + ]; + } + + $groupTags = []; + if (Configuration::get('ECOMAIL_LOAD_GROUP')) { + $customer = new Customer($email); + $groups = $customer->getGroups(); + + foreach ($groups as $group) { + $group = new Group((int) $group); + $group = (array) $group->name; + + if (count($group) === 0) { + continue; + } + + $groupTags[] = $group[array_key_first($group)]; + } + } + + $newsletterTags = $newsletter ? ['prestashop', 'prestashop_newsletter'] : ['prestashop']; + + $this->getAPI() + ->subscribeToList( + Configuration::get('ECOMAIL_LIST_ID'), + array_merge( + ['email' => $email], + $nameData, + $birthdayData, + ['tags' => array_merge($groupTags, $newsletterTags)] + ) + ); + } + } + + // blocknewsletter - customer subscribe + public function hookActionCustomerNewsletterSubscribed(array $params): void + { + if (Configuration::get('ECOMAIL_API_KEY')) { + $customer = Customer::getCustomersByEmail($params['email']); + + if ($customer) { + $customer = end($customer); + + $nameData = []; + $birthdayData = []; + $addressData = []; + + if (Configuration::get('ECOMAIL_LOAD_NAME')) { + $nameData = [ + 'name' => $customer['firstname'], + 'surname' => $customer['lastname'], + ]; + } + + if (Configuration::get('ECOMAIL_LOAD_BIRTHDAY')) { + $birthdayData = [ + 'birthday' => $customer['birthday'], + ]; + } + + if (Configuration::get('ECOMAIL_LOAD_ADDRESS')) { + if (isset($params['order'])) { + $address = new Address($params['order']->id_address_invoice); + $country = new Country($address->id_country); + + $addressData = [ + 'company' => $customer['company'], + 'country' => $country->iso_code, + ]; + } + } + + $groupTags = []; + if (Configuration::get('ECOMAIL_LOAD_GROUP')) { + $groups = $customer->getGroups(); + + foreach ($groups as $group) { + $group = new Group((int) $group); + $group = (array) $group->name; + + if (count($group) === 0) { + continue; + } + + $groupTags[] = $group[array_key_first($group)]; + } + } + + $newsletterTags = $customer->newsletter ? ['prestashop', 'prestashop_newsletter'] : ['prestashop']; + + $this->getAPI() + ->subscribeToList( + Configuration::get('ECOMAIL_LIST_ID'), + array_merge( + ['email' => $customer['email']], + $nameData, + $birthdayData, + $addressData, + ['tags' => array_merge($groupTags, $newsletterTags)] + ) + ); + } else { + $this->getAPI() + ->subscribeToList( + Configuration::get('ECOMAIL_LIST_ID'), + ['email' => $params['email']] + ); + } + } + } + + // Order submitted + public function hookActionValidateOrder(array $params): void + { + if (Configuration::get('ECOMAIL_LOAD_ORDER_DATA')) { + $customer = new Customer($params['order']->id_customer); + + $nameData = []; + $birthdayData = []; + $addressData = []; + + if (Configuration::get('ECOMAIL_LOAD_NAME')) { + $nameData = [ + 'name' => $customer->firstname, + 'surname' => $customer->lastname, + ]; + } + + if (Configuration::get('ECOMAIL_LOAD_BIRTHDAY')) { + $birthdayData = [ + 'birthday' => $customer->birthday, + ]; + } + + if (Configuration::get('ECOMAIL_LOAD_ADDRESS')) { + $address = new Address($params['order']->id_address_invoice); + $country = new Country($address->id_country); + + $addressData = [ + 'city' => $address->city, + 'street' => $address->address1, + 'zip' => $address->postcode, + 'country' => $country->iso_code, + 'company' => $address->company, + ]; + } + + $groupTags = []; + if (Configuration::get('ECOMAIL_LOAD_GROUP')) { + $groups = $customer->getGroups(); + + foreach ($groups as $group) { + $group = new Group((int) $group); + $group = (array) $group->name; + + if (count($group) === 0) { + continue; + } + + $groupTags[] = $group[array_key_first($group)]; + } + } + + $newsletterTags = $customer->newsletter ? ['prestashop', 'prestashop_newsletter'] : ['prestashop']; + + $this->getAPI() + ->subscribeToList( + Configuration::get('ECOMAIL_LIST_ID'), + array_merge( + [ + 'email' => $customer->email, + 'tags' => array_merge($newsletterTags, $groupTags), + ], + $nameData, + $birthdayData, + $addressData + ) + ); + } + + $this->getAPI()->createTransaction($params['order']); + } + + public function hookActionCartSave(array $params): void + { + if (Configuration::get('ECOMAIL_LOAD_CART')) { + if (!isset($this->context->cart)) { + return; + } + + $cartProducts = $this->context->cart->getProducts(); + + $products = []; + foreach ($cartProducts as $p) { + $productCat = new Category($p['id_category_default']); + $products[] = [ + 'productId' => $p['id_product'], + 'img_url' => $this->context->link->getImageLink($p['link_rewrite'], $p['id_image']), + 'url' => $this->context->link->getProductLink((int) $p['id_product'], $p['link_rewrite'], $productCat->link_rewrite[$this->context->language->id]), + 'name' => $p['name'], + 'price' => $p['price_wt'], + ]; + } + + if (!$this->context->customer->email) { + return; + } + + $result = $this->getAPI()->sendBasket($this->context->customer->email, $products); + + if (isset($result->errors)) { + PrestaShopLogger::addLog('Ecomail failed: ' . json_encode($result), 1, null, 'Cart', (int) $this->context->cart->id, true); + } + } + } + + public function hookDisplayFooter(array $params): string + { + $this->context->smarty->assign( + [ + 'ECOMAIL_APP_ID' => Configuration::get('ECOMAIL_APP_ID'), + 'ECOMAIL_FORM_ID' => Configuration::get('ECOMAIL_FORM_ID'), + 'ECOMAIL_FORM_ACCOUNT' => Configuration::get('ECOMAIL_FORM_ACCOUNT'), + 'EMAIL' => $this->context->cookie->email ?? 'empty', + ] + ); + + return $this->display(__FILE__, 'ecomail_scripts.tpl'); + } + + public function createWebserviceKey(): bool + { + $apiAccess = new WebserviceKey(); + $apiAccess->key = substr(str_shuffle('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 1, 32); + $apiAccess->description = 'Ecomail webservice key'; + $apiAccess->save(); + + $permissions = [ + 'customers' => ['GET' => 1], + 'orders' => ['GET' => 1], + 'products' => ['GET' => 1], + 'tags' => ['GET' => 1], + ]; + + WebserviceKey::setPermissionForAccount($apiAccess->id, $permissions); + Configuration::updateValue('ECOMAIL_WEBSERVICE_KEY', $apiAccess->key); + + return true; + } + + public function syncCustomers(string $listId): void + { + $allCustomers = $this->requestGet(sprintf('%s%sapi/', _PS_BASE_URL_, __PS_BASE_URI__), 'customers'); + + $customersToImport = []; + + if (!$allCustomers || !isset($allCustomers['customers'])) { + return; + } + + foreach ($allCustomers['customers'] as $customer) { + $groupTags = []; + + if (isset($customer['associations']) && isset($customer['associations']['groups'])) { + foreach ($customer['associations']['groups'] as $group) { + $group = new Group((int) $group['id']); + $group = (array) $group->name; + $groupTags[] = $group[array_key_first($group)]; + } + } + + $newsletterTags = $customer['newsletter'] === '1' ? ['prestashop_newsletter', 'prestashop'] : ['prestashop']; + + $customersToImport[] = [ + 'name' => $customer['firstname'], + 'surname' => $customer['lastname'], + 'email' => $customer['email'], + 'birthday' => $customer['birthday'], + 'tags' => array_merge($groupTags, $newsletterTags), + ]; + } + + if (count($customersToImport) > 0) { + $chunks = array_chunk($customersToImport, 3000); + + foreach ($chunks as $chunk) { + $this->getAPI()->bulkSubscribeToList($listId, $chunk); + } + } + } + + public function requestGet(string $url, string $event): ?array + { + $ch = curl_init(); + $display = '?display=full'; + $url = $url . $event . $display; + + $headers = [ + 'output_format:JSON', + 'Authorization: Basic ' . base64_encode(Configuration::get('ECOMAIL_WEBSERVICE_KEY') . ':'), + ]; + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($ch); + + curl_close($ch); + + return json_decode(stripslashes($response), true, JSON_UNESCAPED_SLASHES); + } + + public function syncOrders(): void + { + $allOrders = $this->requestGet(sprintf('%s%sapi/', _PS_BASE_URL_, __PS_BASE_URI__), 'orders'); + + $ordersToImport = []; + + if (!$allOrders || !isset($allOrders['orders'])) { + return; + } + + foreach ($allOrders['orders'] as $order) { + if (!isset($order['associations']['order_rows'])) { + continue; + } + + $transaction = $this->getAPI()->buildTransaction($order); + $transactionItems = []; + + foreach ($order['associations']['order_rows'] as $item) { + $transactionItems[] = $this->getAPI()->buildTransactionItems($item, $order['date_add']); + } + + $ordersToImport[] = [ + 'transaction' => $transaction, + 'transaction_items' => $transactionItems, + ]; + } + + if (count($ordersToImport) > 0) { + $chunks = array_chunk($ordersToImport, 1000); + + foreach ($chunks as $chunk) { + $this->getAPI()->bulkOrders($chunk); + } + } + } + + public function hookActionCustomerAccountUpdate(array $params): void + { + $newsletter = $params['customer']->newsletter; + $email = $params['customer']->email; + + if (Configuration::get('ECOMAIL_API_KEY')) { + $nameData = []; + $birthdayData = []; + + if (Configuration::get('ECOMAIL_LOAD_NAME')) { + $firstname = $params['customer']->firstname; + $lastname = $params['customer']->lastname; + + $nameData = [ + 'name' => $firstname, + 'surname' => $lastname, + ]; + } + + if (Configuration::get('ECOMAIL_LOAD_BIRTHDAY')) { + $birthday = $params['customer']->birthday; + + $birthdayData = [ + 'birthday' => $birthday, + ]; + } + + $groupTags = []; + if (Configuration::get('ECOMAIL_LOAD_GROUP')) { + $customer = new Customer($email); + $groups = $customer->getGroups(); + + foreach ($groups as $group) { + $group = new Group((int) $group); + $group = (array) $group->name; + + if (count($group) === 0) { + continue; + } + + $groupTags[] = $group[array_key_first($group)]; + } + } + + $newsletterTags = $newsletter ? ['prestashop', 'prestashop_newsletter'] : ['prestashop']; + + $this->getAPI() + ->subscribeToList( + Configuration::get('ECOMAIL_LIST_ID'), + array_merge( + ['email' => $email], + $nameData, + $birthdayData, + ['tags' => array_merge($groupTags, $newsletterTags)] + ) + ); + } + } + + public function hookActionSubmitCustomerAddressForm(array $params): void + { + if (Configuration::get('ECOMAIL_LOAD_ADDRESS')) { + $country = new Country($params['address']->id_country); + $customer = new Customer($params['address']->id_customer); + + $addressData = [ + 'city' => $params['address']->city, + 'street' => $params['address']->address1, + 'zip' => $params['address']->postcode, + 'country' => $country->iso_code, + 'company' => $params['address']->company, + 'phone' => $params['address']->phone, + ]; + + $this->getAPI() + ->subscribeToList( + Configuration::get('ECOMAIL_LIST_ID'), + array_merge( + ['email' => $customer->email], + $addressData, + ) + ); + } + } + + public function hookAddWebserviceResources(array $params): bool + { + return true; + } +} diff --git a/ecomailemailmarketing/index.php b/ecomailemailmarketing/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/lib/api.php b/ecomailemailmarketing/lib/api.php new file mode 100644 index 0000000..65b4b8d --- /dev/null +++ b/ecomailemailmarketing/lib/api.php @@ -0,0 +1,240 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +class EcomailAPI +{ + protected string $APIKey; + + public function setAPIKey($arg): self + { + $this->APIKey = $arg; + + return $this; + } + + public function getListsCollection() + { + return $this->call('lists'); + } + + public function subscribeToList(string $listId, array $customerData) + { + return $this->call( + sprintf( + 'lists/%d/subscribe', + $listId + ), + 'POST', + [ + 'subscriber_data' => $customerData, + 'resubscribe' => true, + 'update_existing' => true, + 'skip_confirmation' => (bool) Configuration::get('ECOMAIL_SKIP_CONFIRM'), + 'trigger_autoresponders' => (bool) Configuration::get('ECOMAIL_TRIGGER_AUTORESPONDERS'), + ] + ); + } + + public function sendBasket(string $email, array $products) + { + $data = json_encode([ + 'data' => [ + 'data' => [ + 'action' => 'Basket', + 'products' => $products, + ], + ], + ]); + + return $this->call( + 'tracker/events', + 'POST', + [ + 'event' => [ + 'email' => $email, + 'category' => 'ue', + 'action' => count($products) === 0 ? 'PrestaEmptyBasket' : 'PrestaBasket', + 'label' => 'Basket', + 'value' => "$data", + ], + ] + ); + } + + public function createTransaction(Order $order) + { + $arr = []; + + foreach ($order->getProducts() as $orderProduct) { + $arr[] = $this->buildTransactionItems($orderProduct, (int) $order->date_add); + } + + return $this->call( + 'tracker/transaction', + 'POST', + [ + 'transaction' => $this->buildTransaction($order), + 'transaction_items' => $arr, + ] + ); + } + + protected function call(string $url, string $method = 'GET', ?array $data = null) + { + $ch = curl_init(); + + curl_setopt( + $ch, + CURLOPT_URL, + 'https://api2.ecomailapp.cz/' . $url + ); + curl_setopt( + $ch, + CURLOPT_RETURNTRANSFER, + true + ); + curl_setopt( + $ch, + CURLOPT_HEADER, + false + ); + curl_setopt( + $ch, + CURLOPT_HTTPHEADER, + [ + 'Content-Type: application/json', + 'Key: ' . $this->APIKey, + ] + ); + + if (in_array($method, ['POST', 'PUT'])) { + curl_setopt( + $ch, + CURLOPT_CUSTOMREQUEST, + $method + ); + + curl_setopt( + $ch, + CURLOPT_POSTFIELDS, + json_encode($data) + ); + } + + $response = curl_exec($ch); + curl_close($ch); + + return json_decode($response); + } + + public function bulkSubscribeToList(string $listId, array $data) + { + return $this->call( + sprintf( + 'lists/%d/subscribe-bulk', + $listId + ), + 'POST', + [ + 'subscriber_data' => $data, + 'resubscribe' => true, + 'update_existing' => true, + 'skip_confirmation' => (bool) Configuration::get('ECOMAIL_SKIP_CONFIRM'), + ] + ); + } + + public function bulkOrders(array $data) + { + return $this->call( + 'tracker/transaction-bulk', + 'POST', + [ + 'transaction_data' => $data, + ], + ); + } + + /** + * @param array|Order $order + * + * @return array + */ + public function buildTransaction($order): array + { + $addressData = []; + + if (Configuration::get('ECOMAIL_LOAD_ADDRESS')) { + $addressDelivery = new Address($order->id_address_delivery); + + $addressDeliveryCountry = new Country($addressDelivery->id_country); + $iso_code = $addressDeliveryCountry->iso_code; + + $addressData = [ + 'city' => $addressDelivery->city, + 'country' => $iso_code, + ]; + } + + if (is_array($order)) { + $customer = new Customer($order['id_customer']); + } else { + $customer = $order->getCustomer(); + $order = (array) $order; + } + + return array_merge( + [ + 'order_id' => 'presta_' . $order['id'], + 'email' => $customer->email, + 'shop' => 'prestashop', + 'amount' => round($order['total_paid_tax_incl'], 2), + 'tax' => round($order['total_paid_tax_incl'] - $order['total_paid_tax_excl'], 2), + 'shipping' => round($order['total_shipping'], 2), + 'timestamp' => strtotime($order['date_add']), + ], + $addressData + ); + } + + public function buildTransactionItems(array $orderProduct, int $timestamp): array + { + $product = new Product($orderProduct['product_id']); + $category = new Category($product->getDefaultCategory()); + + return [ + 'code' => $orderProduct['product_reference'], + 'title' => $orderProduct['product_name'], + 'category' => $category->getName(), + 'price' => round($orderProduct['unit_price_tax_incl'], 2), + 'amount' => $orderProduct['product_quantity'], + 'timestamp' => strtotime($timestamp), + ]; + } + + public function isApiKeyValid(): bool + { + $response = (array) $this->call('account'); + + return !(isset($response['message']) && $response['message'] === 'Wrong api key'); + } +} diff --git a/ecomailemailmarketing/lib/index.php b/ecomailemailmarketing/lib/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/lib/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/logo.png b/ecomailemailmarketing/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ed0f3b85b6975b7932730684be7b0875a3899053 GIT binary patch literal 3484 zcmaJ^dpy(o|No@K5lX3?beWanxNdHlsC_=4ZMGq~HB)T1VVKQqA|*;ii7>b1GM6Nm zLLp&uU6@;^lRCN_B_%1&w@#hZ@tgBK_5JO#;^ z+n@#jfCkYKc2lf-7C+UciaEbA{|=P8bH4V@hAdm_~7U3N`@j+8xECGeTGbgg+~g9cGVwdrN{uu$lJA z{Z`KA&OC?}#CAN)XSpAC@n9SdVc0T}yB!d_qA&^p4og5sL~%mHA}~?*$iHXmc}jD>D?@1Z9me zx5S`q5dRFMA{(C>fN_KI|Kw7f?2$nN0S{wlcIeO{(?b@fTz;S#%GTD_%p7foMw=)Q zCK1tL0(z85Sj5(^3NR~z!DsUXY;G80QIYP?6$ov-AIkayZ}65dt^XfBgPe;Rugt9?Q&)6~Ptq8H&OMY+X#n!$5o%UBKmg zaJivhU(q#)E8s>1ad`+d$`p+-aHccZVT%#NzbVen7-Cq2fF8zR5n+3zLd2BKW@2D# z91g_6;7+WKEeeH$v6j}>wxG4G6&i12gR`~z%7wWMA%_(v_{wGehYNj|yVwmJo+2~M z;5##Ja9f)VBr9%aDYtB!csG_0x4V|CkdsHPzqDCK<_MUft-AK zm`clqX*qDw069VeUmo@;9wd8CkuN>3j1V(MFS+h1TIwoGO>|T z*dqfhAExdXVM`Q|EU;wIDXJY8)ecidSV{)gI|EC}1QWXO-kIRR3t;ge$uk2KE6ikq z6cM&;$mx(2^2-O0ce(N;uvZ316GPd3B(DrCw+-Ge0{u&%(m_&iF~ly0_?Kb7Lg+-- zzOWncfn3l%9Xyx|dWt|^Bg}7x59EM3J*1+3lJ5mD;4&nXz=v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cp93lmaodC|Vsl&mq|Bhw@*g4&-{E;!?DVVmcUhG{*8$)iz>^BH zrk}gTmB;hz0p8xWg<>PbXBQysHKYbSYuGmA{AYE#5lQJo=~QB;N9^qt>suek%>|yv z0{d!LZ2V{%o;xwQu#2HRzZR=*N77YOdv&>ObY^I|&api|k81--+m`N|+HS%%z8Ok0 ziroG<@-nE-W%fmSiE4PvuwB5rXJ;$ZV&r;z zwDgpc3S!Uq7d6ihHebJy-l(fIYrKaru#&4BBzX^fTn9`TZ%cK4HJUtTV&(Zj?KiiG zS7J+jsN9^nPJ8%mm!|&ed2J&9&AN<0uV6#}#~JpI<|hd+OatEB?r3s2|3mk()y+|> zGz0_rAOFg$54R z2748H=^LlC)#%*+cw%^i;Tn={gr*act@Ng9)9h@<3f;U)K<{c;UhH1fL?-H#t9H@Z zjz2XC;}&r%fE1rRJO9y58&nQ^wocAip1xk9W3Eg@Ui(7(0>q-{#`b#s@#9$Kf=#)G zQGm62+>~r$YtHG7*NS-+2P3CPL#X>_+PK11bwbMLWY0LC3k;TlXXe_wCZV4`SRD#| zAoc9DPprt+HFkRLXyUrea?{E`BJcb$_hJ3(QRr@l@$1}W;#0?8jlZZ><{8K3P4H7& z?mDb?U)ikm+ry$2z@t{qP|K*^wl?Q=ix06>GgwV9=+&`Xs&sikU7rnFUK#tBQZ zOK0NkuWHuoPt9oL|D_9nK_R+7+q_PD1jKQc?=q=&o@_6>^ZSaMsIhnOPu@$|L2iTh ztipm-WttDdrf=P-l0C$KLZLI%O}&ryX4}8*yM$M*%5zoz zgzR~gv&nQYsSlDWt@@Rdi z0UK57vmF<=MWgTN=m%-q1D6@w`h7r~9is7Hp7yoqW+mQ_;;6fs@zVQmuaBOWG+AE+ z`_ssy0UX?roe7^pR*CM V2c4!~y16g@FA;Gra1BU1{(oY)?_&S} literal 0 HcmV?d00001 diff --git a/ecomailemailmarketing/override/index.php b/ecomailemailmarketing/override/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/override/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/override/modules/index.php b/ecomailemailmarketing/override/modules/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/override/modules/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/override/modules/ps_emailsubscription/index.php b/ecomailemailmarketing/override/modules/ps_emailsubscription/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/override/modules/ps_emailsubscription/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/override/modules/ps_emailsubscription/ps_emailsubscription.php b/ecomailemailmarketing/override/modules/ps_emailsubscription/ps_emailsubscription.php new file mode 100644 index 0000000..4657140 --- /dev/null +++ b/ecomailemailmarketing/override/modules/ps_emailsubscription/ps_emailsubscription.php @@ -0,0 +1,40 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +class Ps_EmailsubscriptionOverride extends Ps_Emailsubscription +{ + protected function register($email, $register_status) + { + Hook::exec('actionCustomerNewsletterSubscribed', ['email' => $email]); + + if ($register_status == self::GUEST_NOT_REGISTERED) { + return $this->registerGuest($email); + } + + if ($register_status == self::CUSTOMER_NOT_REGISTERED) { + return $this->registerUser($email); + } + + return false; + } +} diff --git a/ecomailemailmarketing/translations/cs-CZ/ModulesEcomailemailmarketingEcomailemailmarketing.cs-CZ.xlf b/ecomailemailmarketing/translations/cs-CZ/ModulesEcomailemailmarketingEcomailemailmarketing.cs-CZ.xlf new file mode 100644 index 0000000..c08ac4e --- /dev/null +++ b/ecomailemailmarketing/translations/cs-CZ/ModulesEcomailemailmarketingEcomailemailmarketing.cs-CZ.xlf @@ -0,0 +1,177 @@ + + + + + + Invalid API key + Invalid API key + Line: + + + Ecomail email marketing + Ecomail email marketing + Line: + + + Connection of the e-shop to Ecomail. + Napojení e-shopu na Ecomail. + Line: + + + Do you really want to uninstall Ecomail? + Opravdu si přejete odinstalovat napojení na Ecomail? + Line: + + + Synchronisation of existing contacts and orders was successful. + Synchronizece existujících kontaktů a objednávek proběhla v pořádku. + Line: + + + Unable to connect to Ecomail. Please check your API key. + Nepodařilo se spojit se službou Ecomail. Zkontrolujte prosím svůj API klíč. + Line: + + + Connection to Ecomail is active. + Spojení se službou Ecomail je aktivní. + Line: + + + The webhook for updating contacts is at + Webhook pro zpětnou aktualizaci kontaktů je na adrese + Line: + + + Ecomail configuration + Konfigurace Ecomail + Line: + + + Enter your API key + Vložte Váš API klíč + Line: + + + Select a contact list: + Vyberte seznam kontaktů: + Line: + + + Select the contact list in which the new customers will be synchronised. If you have only just created it, it may take up to 30 minutes to connect to it. + Vyberte list do kterého budou zapsáni noví zákazníci. Pokud jste jej vytvořili teprve nyní, může trvat až 30 minut, než bude možné se na něj napojit. + Line: + + + Update data based on order data + Aktualizovat údaje na základě dat z objednávek + Line: + + + Yes + Ano + Line: + + + No + Ne + Line: + + + Send customer names + Odesílat jména zákazníků + Line: + + + Send customer addresses + Odesílat adresy zákazníků + Line: + + + Send birthday of customers + Odesílat data narození zákazníků + Line: + + + Send products in cart + Odesílat produkty v košíku + Line: + + + Send customer groups to tags + Odesílat skupiny zákazníka do štítků + Line: + + + Skip double opt-in + Přeskočit double opt-in + Line: + + + Trigger pipelines for new contacts + Spustit automatizace pro nové kontakty + Line: + + + Synchronise existing contacts and orders (this operation may take a few minutes) + Synchronizovat existující kontakty a objednávky (tato operace může trvat několik minut) + Line: + + + Click the save button to start synchronizing the data. Wait for the page to reload. + Kliknutím na tlačítko uložit zahájíte synchronizaci dat. Počkejte, až se stránka znovu načte. + Line: + + + Save + Uložit + Line: + + + Tracking + Sledování uživatelů + Line: + + + Enter your appId + Vložte Vaše appId + Line: + + + This information is used to activate the tracking code and track transactions - only for the Marketer+ tariff + Tento údaj slouží pro aktivaci trackovacího kódu a sledování transakcí - pouze pro tarif Marketer+ + Line: + + + Sign-up form + Formulář + Line: + + + Insert Ecomail Form ID + Vložte ID Ecomail formuláře + Line: + + + The js.id value in the form code. See the help for more information + Hodnota js.id v kódu formuláře. Více informací se dozvíte v nápovědě + Line: + + + Insert your Ecomail account name + Vložte název Vašeho účtu u Ecomailu + Line: + + + Once your API key is loaded correctly, you will select a list of contacts for your e-shop. + Po správném načtení vašeho API klíče si zvolíte seznam kontaktů pro váš e-shop. + Line: + + + Back to list + Zpět do seznamu + Line: + + + + diff --git a/ecomailemailmarketing/translations/cs-CZ/index.php b/ecomailemailmarketing/translations/cs-CZ/index.php new file mode 100644 index 0000000..296d682 --- /dev/null +++ b/ecomailemailmarketing/translations/cs-CZ/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/translations/index.php b/ecomailemailmarketing/translations/index.php new file mode 100644 index 0000000..296d682 --- /dev/null +++ b/ecomailemailmarketing/translations/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/views/index.php b/ecomailemailmarketing/views/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/views/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/views/templates/hook/ecomail_scripts.tpl b/ecomailemailmarketing/views/templates/hook/ecomail_scripts.tpl new file mode 100644 index 0000000..a5f3458 --- /dev/null +++ b/ecomailemailmarketing/views/templates/hook/ecomail_scripts.tpl @@ -0,0 +1,60 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + *} +{* Ecomail starts *} + +{* Ecomail stops *} +{* Ecomail form start *} + +{* Ecomail form end *} diff --git a/ecomailemailmarketing/views/templates/hook/index.php b/ecomailemailmarketing/views/templates/hook/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/views/templates/hook/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/views/templates/index.php b/ecomailemailmarketing/views/templates/index.php new file mode 100644 index 0000000..089aa56 --- /dev/null +++ b/ecomailemailmarketing/views/templates/index.php @@ -0,0 +1,31 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/ecomailemailmarketing/webhook.php b/ecomailemailmarketing/webhook.php new file mode 100644 index 0000000..1eaf0b0 --- /dev/null +++ b/ecomailemailmarketing/webhook.php @@ -0,0 +1,44 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +require dirname(__FILE__) . '/../../config/config.inc.php'; + +$requestJson = Tools::file_get_contents('php://input'); + +if ($requestJson) { + $request = json_decode($requestJson); + + $email = $request->payload->email; + + $customer = new Customer(); + + $customers = $customer->getCustomersByEmail($email); + + if ($request->payload->status === 'SUBSCRIBED') { + $newsletterStatus = '1'; + } else { + $newsletterStatus = '0'; + } + + foreach ($customers as $customer) { + $customerObject = new Customer($customer['id_customer']); + $customerObject->newsletter = $newsletterStatus; + $customerObject->save(); + } +} diff --git a/monster_ecomail/lib/api.php b/monster_ecomail/lib/api.php deleted file mode 100644 index 8c08ff9..0000000 --- a/monster_ecomail/lib/api.php +++ /dev/null @@ -1,166 +0,0 @@ -APIKey = $arg; - - return $this; - } - - public function getListsCollection() { - - return $this->call( 'lists' ); - - } - - public function subscribeToList( $listId, $customerData ) { - - return $this->call( - sprintf( - 'lists/%d/subscribe', - $listId - ), - 'POST', - array( - 'subscriber_data' => $customerData, - 'resubscribe' => true, - 'update_existing' => true, - 'skip_confirmation' => Configuration::get('MONSTER_ECOMAIL_SKIP_CONFIRM')?true:false - ) - ); - - } - - public function sendBasket($email, $products ) { - $data = json_encode( - array( - 'data' => array( - 'data' => array( - 'action' => 'Basket', - 'products' => $products - ) - ) - )); - return $this->call( - 'tracker/events', - 'POST', - array( - 'event' => array( - 'email' => $email, - 'category' => 'ue', - 'action' => 'Basket', - 'label' => 'Basket', - 'value' => "$data" - ) - ) - ); - } - - public function createTransaction( Order $order ) { - - $shopUrl = new ShopUrl( $order->id_shop ); - - $addressData = array(); - if(Configuration::get('MONSTER_ECOMAIL_LOAD_ADDRESS')) { - $addressDelivery = new Address($order->id_address_delivery); - - $addressData = array( - 'city' => $addressDelivery->city, - 'country' => $addressDelivery->country - ); - } - - $arr = array(); - foreach ($order->getProducts() as $orderProduct) { - $product = new Product($orderProduct['product_id']); - $category = new Category($product->getDefaultCategory()); - $arr[] = array( - 'code' => $orderProduct['product_reference'], - 'title' => $orderProduct['product_name'], - 'category' => $category->getName(), - 'price' => round($orderProduct['unit_price_tax_incl'], 2), - 'amount' => $orderProduct['product_quantity'], - 'timestamp' => strtotime($order->date_add) - ); - } - - return $this->call( - 'tracker/transaction', - 'POST', - array( - 'transaction' => array_merge( - array( - 'order_id' => $order->id, - 'email' => $order->getCustomer()->email, - 'shop' => $shopUrl->getURL(), - 'amount' => round($order->total_paid_tax_incl, 2), - 'tax' => round($order->total_paid_tax_incl - $order->total_paid_tax_excl, 2), - 'shipping' => round($order->total_shipping, 2), - 'timestamp' => strtotime( $order->date_add ) - ), $addressData), - 'transaction_items' => $arr - ) - ); - - } - - protected function call( $url, $method = 'GET', $data = null ) { - $ch = curl_init(); - - curl_setopt( - $ch, - CURLOPT_URL, - "http://api2.ecomailapp.cz/" . $url - ); - curl_setopt( - $ch, - CURLOPT_RETURNTRANSFER, - TRUE - ); - curl_setopt( - $ch, - CURLOPT_HEADER, - FALSE - ); - curl_setopt( - $ch, - CURLOPT_HTTPHEADER, - array( - "Content-Type: application/json", - 'Key: ' . $this->APIKey - ) - ); - - if( in_array( - $method, - array( - 'POST', - 'PUT' - ) - ) - ) { - - curl_setopt( - $ch, - CURLOPT_CUSTOMREQUEST, - $method - ); - - curl_setopt( - $ch, - CURLOPT_POSTFIELDS, - json_encode( $data ) - ); - - } - - $response = curl_exec( $ch ); - curl_close( $ch ); - - return json_decode( $response ); - } - -} \ No newline at end of file diff --git a/monster_ecomail/logo.png b/monster_ecomail/logo.png deleted file mode 100644 index 39c1325289770cbccf873b7ce22320ece79f84c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6616 zcmbVRXEM`)8!s@1C;HKwf?dD;D!vGY~PL>#syI2bwj4s9k?d8&gkp%#V-R<-Z+zd3- zrLCN>!WMrp!k$>?OEv%?i}ZB1uzG@V`GtCe~zILj=vyoPvjtf z2W6n4&7tgs!*GZRiwjx7;cyNKDPg#nBtk??kV6Cp7lXp2pm3NF3@#0aNsGWZ{&hhv zz2VT-(z+D^%vUJO&9aOVf;t5tG<^r2C9p3b;9GUF8g84^$+>7cK_YcAK+y)(posX%cfX3 zpq#AmSd63FU6dT;@{2Iq4lOMyDk&uj6O|N#p<$PgOIgTLLdsf5MABN!!a~$aQc?u* zkDdR-7ZE{-sGw9uRV5@5aJY(u5<(HKq=Z5#il{0o!=%Lj;ofz0b+d4^!u;dg?$Y@^Iz<)26?(MqzMv z?ijQx&I!x$SDmHp{zD9K3=DyQ!L5bRk{Fnfg@hDeotNwGoen24jlZu7<`v?9!1|3J0K?(s z;~^;E|=F}>_pLWd~Q|9o$AnK;X($e}Ol*NX|4 z-815lRRZA&sGF^M7jk;5ETHuul`ImurJ_1_ohJ2DZk)laGP1yDT^YFjlRCk z#SsBYtWAO@;i4jLRnVpe_8*m#s%%y;&up{!2T=nHLJdhY$h1ehW6WXtqw0u~VR}OJ z8@2>X18pEh@)!ZJ=PFS99vYlaIfUHb&JkKB_%oa0L;`1l*A${?7xqcufHaw`mO;RC z)=~jJss#Ihf=D9tZ~uJYwFA(SMYwqBAnSro7YPVyE)R@%FO+{tKdz(?d{FTGy7#(j zyP+Z-H9c3wvcOFW@GMS83emRFFIs74)o}FMWEgo#5JKh} zpB+r3xZa!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Lo_x#Vlmb)sNsA47aXa55%)dyYx diff --git a/monster_ecomail/mm_logo.png b/monster_ecomail/mm_logo.png deleted file mode 100644 index aead4a28eb04946502f2f0c5c593d3efdd342a13..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14752 zcmeHu^;=s{&~JiMtSuBNUV%a>T1apxRV2{j4h2H-Ai*U-A*E=GH+TyaclRQ}p~VRj z++6|$x%uAv58Pkh=XuZbBxm>R%-|VOQ(-kT<;vrt*t&-nOk}}_gKjQ0Fp1>y;Ril zoZg;o@?L&D&b7XNZRu;rhh|le0ojEecF`{v@%9>)R1_=3)ufdditE=C=@{CTTNc0S zWsS~$%C%DTrW#~%BKo6S=WDzrQ8(Z=uyOCG>nAawzhegyLvPr>S?ERu&?rBt09d02B>##76!Jb+ zullRU91UeikOQ7fo>KuK_DuDJJ;!pxk91_H{*tQJ~k-Sf803>YtnJ*NWv>~EUTxT_lU zX*Bv&-i;d&gW^B#!~Xt{cHFwR_QcujW9V;y39f|$b2D}1vvhkRK(6{m7eoZ8+mN>M z#X#Wy@eF(eLQ*2Fe%}IgE5j`j7Mox|Og4%{F)EWF($g&x;Qvb$kPx~{xBf1myGO)s zkvX3*iFNXf(<)y6-}3SbTJ^20nf0%od3Q;{P;FpLq|~Js&wxRqz`wHaYnFT>E-L3I z3o^b^9j&6NywotqU_$jgx3}z1ivr63iig902)CYF(+dMzKaDT&X;$pzEa&;u<#!Mo zt#TwaqekgEzGkYoKG>xv2j3b8GS74dqP}e`7=;|`r$iD6^08g~l`r|IB0Z=ko*GlN zPPRoFP*zJ2lYqy&fM(yZt2&^+dUOm}iYy?rcx_oJXTv6tI3+IdINz(Jsx>V8T$PEd z*5+QVj7&AIKKzc>f(?azELW|U19w~WfHV8m#rB^24GrRt8y~~$x}f{0c`Y?$B4~-Z zwL?vz1|yg9ToJDpgoBN-;j5zAGN`xA)~qiu)NI&FeWyIz=2idCxN=!Ki9u4txs0FT zWHcX9iXSPufCt=ie`Bph>!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8*eb-`D*By35e|(^yA#gS#umPYJu-bhjl$7wO9<`gS58r? z=JV`t;JvG&YZBFhhTg*{5m;yjPirzyYu#{&2FFN8a(K8|D$A*~J1V?JwmH|Zi=Gu5H%vHY64GbosesUo^5#Z|aFJ(ds0i@SO^g~-z(^#A zg9aq{6z>Tnwpgh@GWjU(bQ`OYqyjn(h;7@*F)@o-Vg>?fNhfQ~ZhDyN5yXYw)I@Be zOhW(UH$v4fKA*~&V)xi8QkfLT>4CJCDzlM*HvuO%O+~(u0CLevXR&~TjmCd8l^Wze zx|!b;ZBI}OC9nnJY!gb!Q|Ej_>t^4}S_|GoZydcfl1hLjnQTb)@Q%I!q= PAIG~_ke9_T%!2+8g)e^} diff --git a/monster_ecomail/monster_ecomail.php b/monster_ecomail/monster_ecomail.php deleted file mode 100644 index b99ed6a..0000000 --- a/monster_ecomail/monster_ecomail.php +++ /dev/null @@ -1,640 +0,0 @@ -name = 'monster_ecomail'; - $this->tab = 'emailing'; - $this->version = '1.9.702'; - $this->author = 'MONSTER MEDIA, s.r.o.'; - $this->need_instance = 0; - $this->ps_versions_compliancy = array('min' => '1.5.1', 'max' => '1.7.999'); - $this->bootstrap = true; - - parent::__construct(); - - $this->displayName = $this->l('Ecomail'); - $this->description = $this->l('Napojení e-shopu na Ecomail.'); - - $this->confirmUninstall = $this->l('Opravdu si přejete odinstalovat napojení na Ecomail?'); - } - - public function install() - { - return parent::install() && - $this->setValues() && - $this->setTab() && - $this->setDatabase() && - $this->setHooks() && - unlink(_PS_CACHE_DIR_.'/class_index.php'); - } - - public function uninstall() - { - return parent::uninstall() && - $this->unsetValues() && - $this->unsetTab() && - $this->unsetDatabase(); - } - - //hodnoty v configu - public function setValues(){ - return Configuration::updateValue('MONSTER_ECOMAIL_SKIP_CONFIRM', 1); - } - - public function unsetValues(){ - return - Configuration::deleteByName('MONSTER_ECOMAIL_API_KEY') && - Configuration::deleteByName('MONSTER_ECOMAIL_APP_ID') && - Configuration::deleteByName('MONSTER_ECOMAIL_LIST_ID'); - - } - - //taby v adminu - public function setTab(){ - return true; - } - - public function unsetTab(){ - return true; - } - - //tabulky v DB - public function setDatabase(){ - return true; - } - - public function unsetDatabase(){ - return true; - } - - //hooky - public function setHooks(){ - - return - $this->registerHook( 'actionCustomerAccountAdd' ) && - $this->registerHook( 'actionValidateOrder' ) && - $this->registerHook( 'displayFooter' ) && - $this->registerHook( 'actionCustomerNewsletterSubscribed' ) && - $this->registerHook( 'actionCartSave'); - } - - public function getContent() - { - $output = null; - - if (Tools::isSubmit('submit'.$this->name)) - { - Configuration::updateValue('MONSTER_ECOMAIL_API_KEY', Tools::getValue('api_key')); - Configuration::updateValue('MONSTER_ECOMAIL_APP_ID', Tools::getValue('app_id')); - Configuration::updateValue('MONSTER_ECOMAIL_LIST_ID', Tools::getValue('list_id')); - - Configuration::updateValue('MONSTER_ECOMAIL_LOAD_ORDER_DATA', Tools::getValue('load_order_data')); - - Configuration::updateValue('MONSTER_ECOMAIL_LOAD_NAME', Tools::getValue('load_name')); - Configuration::updateValue('MONSTER_ECOMAIL_LOAD_ADDRESS', Tools::getValue('load_address')); - Configuration::updateValue('MONSTER_ECOMAIL_LOAD_BIRTHDAY', Tools::getValue('load_birthday')); - Configuration::updateValue('MONSTER_ECOMAIL_LOAD_CART', Tools::getValue('load_cart')); - Configuration::updateValue('MONSTER_ECOMAIL_SKIP_CONFIRM', Tools::getValue('skip_confirmation')); - - } - - if(Configuration::get( 'MONSTER_ECOMAIL_API_KEY' ) && !$this->getAPI()->getListsCollection()){ - $output .= $this->displayError("Nepodařilo se spojit se službou Ecomail. Zkontrolujte prosím svůj API klíč."); - } - - if(Configuration::get( 'MONSTER_ECOMAIL_API_KEY' ) && $this->getAPI()->getListsCollection()){ - $output .= $this->displayConfirmation($this->l('Spojení se službou Ecomail je aktivní.')); - $output .= $this->displayConfirmation($this->l('Webhook pro zpětnou aktualizaci kontaktů je na adrese ')."".(isset($_SERVER['HTTPS']) ? "https" : "http") . "://".$_SERVER['HTTP_HOST']."/modules/monster_ecomail/webhook.php"); - } - - if(_PS_VERSION_ < 1.6){ - $output .= $this->displayError("Návod k aktivaci odesílání subscribů z modulu 'Blok Odběr novinek [Newsletter block]' do systému Ecomail pro vaší verzi PrestaShopu najdete zde."); - } - - return $output.$this->displayForm(); - } - - public function displayForm() - { - // Get default language - $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); - - if(Configuration::get( 'MONSTER_ECOMAIL_API_KEY' ) && $this->getAPI()->getListsCollection()){ - - $options = array(); - if( Configuration::get( 'MONSTER_ECOMAIL_API_KEY' ) ) { - $listsCollection = $this->getAPI() - ->getListsCollection(); - foreach( $listsCollection as $list ) { - $options[] = array( - 'id_option' => $list->id, - 'name' => $list->name - ); - } - } - - // Init Fields form array - $fields_form[0]['form'] = array( - 'legend' => array( - 'title' => $this->l('Konfigurace Ecomail'), - ), - 'input' => array( - array( - 'type' => 'text', - 'label' => $this->l( 'Vložte Váš API klíč' ), - 'name' => 'api_key', - 'rows' => 20, - 'required' => true - ), - array( - 'type' => 'select', - 'label' => $this->l( 'Vyberte seznam kontaktů:' ), - 'desc' => $this->l( - 'Vyberte list do kterého budou zapsáni noví zákazníci. Pokud jste jej vytvořili teprve nyní, může trvat až 30 minut, než bude možné se na něj napojit.' - ), - 'name' => 'list_id', - 'required' => true, - 'options' => array( - 'query' => $options, - 'id' => 'id_option', - 'name' => 'name' - ) - ), - array( - 'type' => (_PS_VERSION_ > 1.5) ? 'switch' : 'radio', - 'class' => 't', - 'label' => $this->l('Aktualizovat údaje na základě dat z objednávek'), - 'name' => 'load_order_data', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - 'label' => $this->l('Yes') - ), - array( - 'id' => 'active_off', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - ), - array( - 'type' => (_PS_VERSION_ > 1.5) ? 'switch' : 'radio', - 'class' => 't', - 'label' => $this->l('Odesílat jména zákazníků'), - 'name' => 'load_name', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - 'label' => $this->l('Yes') - ), - array( - 'id' => 'active_off', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - ), - array( - 'type' => (_PS_VERSION_ > 1.5) ? 'switch' : 'radio', - 'class' => 't', - 'label' => $this->l('Odesílat adresy zákazníků'), - 'name' => 'load_address', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - 'label' => $this->l('Yes') - ), - array( - 'id' => 'active_off', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - ), - array( - 'type' => (_PS_VERSION_ > 1.5) ? 'switch' : 'radio', - 'class' => 't', - 'label' => $this->l('Odesílat data narození zákazníků'), - 'name' => 'load_birthday', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - 'label' => $this->l('Yes') - ), - array( - 'id' => 'active_off', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - ), - array( - 'type' => (_PS_VERSION_ > 1.5) ? 'switch' : 'radio', - 'class' => 't', - 'label' => $this->l('Odesílat produkty v košíku'), - 'name' => 'load_cart', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - 'label' => $this->l('Yes') - ), - array( - 'id' => 'active_off', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - ), - array( - 'type' => (_PS_VERSION_ > 1.5) ? 'switch' : 'radio', - 'class' => 't', - 'label' => $this->l('Přeskočit double opt-in'), - 'name' => 'skip_confirmation', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - 'label' => $this->l('Yes') - ), - array( - 'id' => 'active_off', - 'value' => 0, - 'label' => $this->l('No') - ) - ), - ), - ), - 'submit' => array( - 'title' => $this->l('Save'), - 'class' => 'btn btn-default pull-right' - ) - ); - - $fields_form[1]['form'] = array( - 'legend' => array( - 'title' => $this->l('Marketer+'), - ), - 'input' => array( - array( - 'type' => 'text', - 'label' => $this->l( 'Vložte Vaše appId' ), - 'desc' => $this->l( - 'Tento údaj slouží pro aktivaci trackovacího kódu a sledování transakcí - pouze pro tarif Marketer+' - ), - 'name' => 'app_id', - 'rows' => 20 - ) - ), - 'submit' => array( - 'title' => $this->l('Save'), - 'class' => 'btn btn-default pull-right' - ) - ); - - }else{ - $fields_form[0]['form'] = array( - 'legend' => array( - 'title' => $this->l('Konfigurace Ecomail'), - ), - 'input' => array( - array( - 'type' => 'text', - 'label' => $this->l( 'Vložte Váš API klíč' ), - 'name' => 'api_key', - 'rows' => 20, - 'required' => true, - 'desc' => $this->l('Po správném načtení vašeho API klíče si zvolíte seznam kontaktů pro váš e-shop.') - ) - ), - 'submit' => array( - 'title' => $this->l('Save'), - 'class' => 'btn btn-default pull-right' - ) - ); - } - - $helper = new HelperForm(); - - // Module, token and currentIndex - $helper->module = $this; - $helper->name_controller = $this->name; - $helper->token = Tools::getAdminTokenLite('AdminModules'); - $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; - - // Language - $helper->default_form_language = $default_lang; - $helper->allow_employee_form_lang = $default_lang; - - // Title and toolbar - $helper->title = $this->displayName; - $helper->show_toolbar = true; - $helper->toolbar_scroll = true; - $helper->submit_action = 'submit'.$this->name; - $helper->toolbar_btn = array( - 'save' => - array( - 'desc' => $this->l('Save'), - 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. - '&token='.Tools::getAdminTokenLite('AdminModules'), - ), - 'back' => array( - 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), - 'desc' => $this->l('Back to list') - ) - ); - - // Load current value - $helper->fields_value['api_key'] = Configuration::get('MONSTER_ECOMAIL_API_KEY'); - $helper->fields_value['app_id'] = Configuration::get('MONSTER_ECOMAIL_APP_ID'); - $helper->fields_value['list_id'] = Configuration::get('MONSTER_ECOMAIL_LIST_ID'); - $helper->fields_value['load_order_data'] = Configuration::get('MONSTER_ECOMAIL_LOAD_ORDER_DATA'); - - $helper->fields_value['load_name'] = Configuration::get('MONSTER_ECOMAIL_LOAD_NAME'); - $helper->fields_value['load_address'] = Configuration::get('MONSTER_ECOMAIL_LOAD_ADDRESS'); - $helper->fields_value['load_birthday'] = Configuration::get('MONSTER_ECOMAIL_LOAD_BIRTHDAY'); - $helper->fields_value['load_cart'] = Configuration::get('MONSTER_ECOMAIL_LOAD_CART'); - $helper->fields_value['skip_confirmation'] = Configuration::get('MONSTER_ECOMAIL_SKIP_CONFIRM'); - - return $helper->generateForm($fields_form); - } - - protected function getAPI() { - require_once __DIR__ . '/lib/api.php'; - $obj = new EcomailAPI(); - $obj->setAPIKey( Configuration::get('MONSTER_ECOMAIL_API_KEY') ); - return $obj; - } - - //registrace zákazníka, registrace v košíku, objednávka bez registrace - public function hookActionCustomerAccountAdd( $params ) { - - if(_PS_VERSION_ < 1.7){ - $newsletter = $params['_POST']['newsletter']; - $email = $params['_POST']['email']; - }else{ - $newsletter = $params['newCustomer']->newsletter; - $email = $params['newCustomer']->email; - } - - if( $newsletter ) { - - if( Configuration::get('MONSTER_ECOMAIL_API_KEY') ) { - - $nameData = array(); - $birthdayData = array(); - $addressData = array(); - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_NAME')){ - - $firstname = (_PS_VERSION_ < 1.7) ? $params['_POST']['customer_firstname'] : $params['newCustomer']->firstname; - $lastname = (_PS_VERSION_ < 1.7) ? $params['_POST']['customer_lastname'] : $params['newCustomer']->lastname; - - $nameData = array( - 'name' => $firstname, - 'surname' => $lastname - ); - } - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_BIRTHDAY')){ - - if(_PS_VERSION_ < 1.7){ - $birthday = (empty($params['_POST']['years']) ? '' : (int)$params['_POST']['years'].'-'.(int)$params['_POST']['months'].'-'.(int)$params['_POST']['days']); - if (!Validate::isBirthDate($birthday)) { - $birthday = ""; - } - }else{ - $birthday = $params['newCustomer']->birthday; - } - - $birthdayData = array( - 'birthday' => $birthday - ); - } - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_ADDRESS')) { - - //pokud probíhá nákup bez registrace nebo registrace v košíku - if(_PS_VERSION_ < 1.7) { - if ($params['_POST']['id_country']) { - $country = new Country($params['_POST']['id_country']); - - $addressData = array( - "company" => $params['_POST']['company'], - "city" => $params['_POST']['city'], - "street" => $params['_POST']['address1'], - "zip" => $params['_POST']['postcode'], - "country" => $country->iso_code - ); - } - }else{ - - } - } - - $this->getAPI() - ->subscribeToList( - Configuration::get('MONSTER_ECOMAIL_LIST_ID'), - array_merge( - array('email' => $email),$nameData,$birthdayData,$addressData) - ); - } - } - } - - //subscribe zákazníka v modulu blocknewsletter - public function hookActionCustomerNewsletterSubscribed( $params ) { - - $monsterLogWS = new FileLogger(0); - $monsterLogWS->setFilename(_PS_ROOT_DIR_ . "/log/ecomail.log"); - $monsterLogWS->logDebug("executing hook"); - - if( Configuration::get('MONSTER_ECOMAIL_API_KEY') ) { - - $monsterLogWS->logDebug("api ok"); - - $customer = Customer::getCustomersByEmail( $params['email'] ); - - $monsterLogWS->logDebug("email = ".$params['email'] ); - - //uživatel existuje v eshopu - if($customer){ - - $monsterLogWS->logDebug("customer existuje v eshopu"); - - $customer = end($customer); //po registraci už není možné vytvářet další účty, takže bude mít nejvíc dat - - $nameData = array(); - $birthdayData = array(); - $addressData = array(); - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_NAME')){ - $nameData = array( - 'name' => $customer['firstname'], - 'surname' => $customer['lastname'] - //'gender' => male/female - ecomail si dopočítává automaticky podle jmen - ); - } - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_BIRTHDAY')){ - $birthdayData = array( - 'birthday' => $customer['birthday'] - ); - } - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_ADDRESS')){ - if(isset($params['order'])){ - $address = new Address($params['order']->id_address_invoice); - $country = new Country($address->id_country); - - $addressData = array( - 'company' => $customer['company'] - ); - } - } - - $monsterLogWS->logDebug("subscribeToList"); - - $this->getAPI() - ->subscribeToList( - Configuration::get('MONSTER_ECOMAIL_LIST_ID'), - array_merge(array('email' => $customer['email']),$nameData,$birthdayData,$addressData) - - ); - }else{//uživatel neexistuje v eshopu - je to visitor - - $monsterLogWS->logDebug("uživatel neexistuje v eshopu"); - $this->getAPI() - ->subscribeToList( - Configuration::get('MONSTER_ECOMAIL_LIST_ID'), - array('email' => $params['email']) - ); - - } - } - } - - //dokončení objednávky - public function hookActionValidateOrder( $params ) { - - //aktualizace stávajících údajů + subscribe uživatele, který se registroval dříve - if(Configuration::get('MONSTER_ECOMAIL_LOAD_ORDER_DATA')){ - $customer = new Customer($params['order']->id_customer); - - //pokud zákazník nesouhlasil s newsletterem, neřešíme ho ani zde - if($customer->newsletter){ - $nameData = array(); - $birthdayData = array(); - $addressData = array(); - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_NAME')){ - $nameData = array( - 'name' => $customer->firstname, - 'surname' => $customer->lastname - - ); - } - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_BIRTHDAY')){ - $birthdayData = array( - 'birthday' => $customer->birthday - - ); - } - - if(Configuration::get('MONSTER_ECOMAIL_LOAD_ADDRESS')){ - $address = new Address($params['order']->id_address_invoice); - $country = new Country($address->id_country); - - $addressData = array( - "city" => $address->city, - "street" => $address->address1, - "zip" => $address->postcode, - "country" => $country->iso_code, - "company" => $address->company - ); - } - - $this->getAPI() - ->subscribeToList( - Configuration::get('MONSTER_ECOMAIL_LIST_ID'), - array_merge(array('email' => $customer->email),$nameData,$birthdayData,$addressData) - ); - } - } - - //přenos transakce pro tarif Marketer+ - $this->getAPI() - ->createTransaction( $params['order'] ); - } - - public function hookActionCartSave($params) - { - if(Configuration::get('MONSTER_ECOMAIL_LOAD_CART')){ - if (!isset($this->context->cart)) - return; - - $cart_products = $this->context->cart->getProducts(); - - $products = array(); - foreach($cart_products as $p){ - $productCat = new Category($p["id_category_default"]); - $products[] = array( - "productId" => $p["id_product"], - "img_url" => $this->context->link->getImageLink($p['link_rewrite'], $p["id_image"]), - "url" => $this->context->link->getProductLink((int)$p["id_product"], $p['link_rewrite'], $productCat->link_rewrite[$this->context->language->id]), - "name" => $p["name"], - "price" => $p["price_wt"], - "description" => $p["description_short"] - ); - } - $result = $this->getAPI()->sendBasket($this->context->customer->email, $products); - if (isset($result->errors)) { - PrestaShopLogger::addLog('Ecomail failed: '. json_encode($result->errors), 1, null, 'Cart', (int)$this->context->cart->id, true); - } - } else { - return; - } - } - - public function hookDisplayFooter($params) { - - $output = ' - - -'; - - return $output; - } - - -} diff --git a/monster_ecomail/override/modules/blocknewsletter/blocknewsletter.php b/monster_ecomail/override/modules/blocknewsletter/blocknewsletter.php deleted file mode 100644 index 628aa25..0000000 --- a/monster_ecomail/override/modules/blocknewsletter/blocknewsletter.php +++ /dev/null @@ -1,21 +0,0 @@ - $email ) - ); - - if ($register_status == self::GUEST_NOT_REGISTERED) - return $this->registerGuest($email); - - if ($register_status == self::CUSTOMER_NOT_REGISTERED) - return $this->registerUser($email); - - return false; - } -} \ No newline at end of file diff --git a/monster_ecomail/override/modules/ps_emailsubscription/ps_emailsubscription.php b/monster_ecomail/override/modules/ps_emailsubscription/ps_emailsubscription.php deleted file mode 100644 index 345adb5..0000000 --- a/monster_ecomail/override/modules/ps_emailsubscription/ps_emailsubscription.php +++ /dev/null @@ -1,53 +0,0 @@ - -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -if (!defined('_PS_VERSION_')) { - exit; -} - -class Ps_EmailsubscriptionOverride extends Ps_Emailsubscription -{ - - protected function register($email, $register_status) - { - - Hook::exec( - 'actionCustomerNewsletterSubscribed', - array( 'email' => $email ) - ); - - if ($register_status == self::GUEST_NOT_REGISTERED) { - return $this->registerGuest($email); - } - - if ($register_status == self::CUSTOMER_NOT_REGISTERED) { - return $this->registerUser($email); - } - - return false; - } - -} diff --git a/monster_ecomail/readme_1.5.html b/monster_ecomail/readme_1.5.html deleted file mode 100644 index 0e5b347..0000000 --- a/monster_ecomail/readme_1.5.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - -
-

Odesílání subscribů z modulu
"Blok Odběr novinek [Newsletter block]" do systému Ecomail

- - -

PrestaShop s verzí nižší, než 1.6.0.11 neumí úpravu modulu jiným modulem. -Proto je potřeba tuto drobnou změnu provézt ručně. Postup je následující:

- -
    -
  1. V souboru "modules/blocknewsletter/blocknewsletter.php"
  2. -
  3. Najděte řádek s funkcí "register".
    - Pravděpodobně bude vypadat takto: "protected function register($email, $register_status)"
  4. -
  5. Přepište funkci touto verzí:
  6. -
- -

-    protected function register($email, $register_status)
-    {
-        Hook::exec(
-        'actionCustomerNewsletterSubscribed',
-        array( 'email' => $email )
-        );
-
-        if ($register_status == self::GUEST_NOT_REGISTERED)
-        return $this->registerGuest($email);
-
-        if ($register_status == self::CUSTOMER_NOT_REGISTERED)
-        return $this->registerUser($email);
-
-        return false;
-    }
-    
-
- -
- - - - - diff --git a/monster_ecomail/webhook.php b/monster_ecomail/webhook.php deleted file mode 100644 index ef907e1..0000000 --- a/monster_ecomail/webhook.php +++ /dev/null @@ -1,27 +0,0 @@ -payload->email; - - $customer = new Customer(); - - $customers = $customer->getCustomersByEmail($email); - - if($request->payload->status === 'SUBSCRIBED'){ - $newsletterStatus = '1'; - } else { - $newsletterStatus = '0'; - } - - foreach ($customers as $customer) { - $customerObject = new Customer($customer['id_customer']); - $customerObject->newsletter = $newsletterStatus; - $customerObject->save(); - } -} \ No newline at end of file