* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7541 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_CAN_LOAD_FILES_')) exit; class Followup extends Module { function __construct() { $this->name = 'followup'; $this->tab = 'advertising_marketing'; $this->version = '1.0'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->confKeys = array( 'PS_FOLLOW_UP_ENABLE_1', 'PS_FOLLOW_UP_ENABLE_2', 'PS_FOLLOW_UP_ENABLE_3', 'PS_FOLLOW_UP_ENABLE_4', 'PS_FOLLOW_UP_AMOUNT_1', 'PS_FOLLOW_UP_AMOUNT_2', 'PS_FOLLOW_UP_AMOUNT_3', 'PS_FOLLOW_UP_AMOUNT_4', 'PS_FOLLOW_UP_DAYS_1', 'PS_FOLLOW_UP_DAYS_2', 'PS_FOLLOW_UP_DAYS_3', 'PS_FOLLOW_UP_DAYS_4', 'PS_FOLLOW_UP_THRESHOLD_3', 'PS_FOLLOW_UP_DAYS_THRESHOLD_4', 'PS_FOLLOW_UP_CLEAN_DB'); parent::__construct(); $this->displayName = $this->l('Customer follow-up'); $this->description = $this->l('Follow-up with your customers with daily customized e-mails.'); $this->confirmUninstall = $this->l('Are you sure you want to delete all settings and your logs?'); } public function install() { $logEmailTable = Db::getInstance()->Execute(' CREATE TABLE '._DB_PREFIX_.'log_email ( `id_log_email` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `id_email_type` INT UNSIGNED NOT NULL , `id_discount` INT UNSIGNED NOT NULL , `id_customer` INT UNSIGNED NULL , `id_cart` INT UNSIGNED NULL , `date_add` DATETIME NOT NULL, INDEX `date_add`(`date_add`), INDEX `id_cart`(`id_cart`) ) ENGINE='._MYSQL_ENGINE_); foreach ($this->confKeys AS $key) Configuration::updateValue($key, 0); Configuration::updateValue('PS_FOLLOWUP_SECURE_KEY', strtoupper(Tools::passwdGen(16))); return parent::install(); } public function uninstall() { foreach ($this->confKeys AS $key) Configuration::deleteByName($key); Configuration::deleteByName('PS_FOLLOWUP_SECURE_KEY'); Db::getInstance()->Execute('DROP TABLE '._DB_PREFIX_.'log_email'); return parent::uninstall(); } public function getContent() { /* Save settings */ if (Tools::isSubmit('submitFollowUp')) foreach ($this->confKeys AS $c) Configuration::updateValue($c, (float)(Tools::getValue($c))); /* Init */ $conf = Configuration::getMultiple($this->confKeys); foreach ($this->confKeys AS $k) if (!isset($conf[$k])) $conf[$k] = ''; $currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); $n1 = $this->cancelledCart(true); $n2 = $this->reOrder(true); $n3 = $this->bestCustomer(true); $n4 = $this->badCustomer(true); echo '