44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Module Ekomi
|
||
|
*
|
||
|
* @category Advertising and Marketing
|
||
|
* @author Web in Color <addons@webincolor.fr>
|
||
|
* @copyright 2013 WebInColor
|
||
|
* @version 1.0
|
||
|
* @link http://www.webincolor.fr/
|
||
|
* @since File available since Release 1.0
|
||
|
*/
|
||
|
|
||
|
|
||
|
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||
|
|
||
|
// init front controller in order to use Tools::redirect
|
||
|
$controller = new FrontController();
|
||
|
$controller->init();
|
||
|
|
||
|
if(Tools::getValue('id_customer'))
|
||
|
{
|
||
|
//We retrieve customer id
|
||
|
$id_customer = Db::getInstance()->ExecuteS('SELECT `id_customer` FROM `'._DB_PREFIX_.'wic_ekomi_order_email` WHERE MD5( `id_customer` ) = \''.Tools::getValue('id_customer').'\';');
|
||
|
|
||
|
if(isset($id_customer[0]['id_customer']))
|
||
|
{
|
||
|
//We verify if customer is unsubscribe to ekomi email
|
||
|
$id_customer_unsubscribe = Db::getInstance()->ExecuteS('SELECT `id_customer` FROM `'._DB_PREFIX_.'ekomi_unsubscribe` WHERE `id_customer` = '.(int)$id_customer.';');
|
||
|
|
||
|
if(!isset($id_customer_unsubscribe[0]['id_customer']))
|
||
|
{
|
||
|
$sql = 'INSERT INTO `'._DB_PREFIX_.'ekomi_unsubscribe` (`id_ekomi_unsubscribe`,`id_customer`) VALUES (\'\','.(int)$id_customer[0]['id_customer'].');';
|
||
|
Db::getInstance()->Execute($sql);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
include(dirname(__FILE__).'/../../header.php');
|
||
|
|
||
|
echo Module::display(dirname(__FILE__).'/ekomi.php', 'views/templates/front/ekomi_unsubscribe.tpl');
|
||
|
|
||
|
include(dirname(__FILE__).'/../../footer.php');
|
||
|
|
||
|
?>
|