Merge branch 'ticket-13351-EdTag'
This commit is contained in:
commit
bcbab8adbb
307
modules/ant_trackingtag/AdminAntTrackingTag.php
Normal file
307
modules/ant_trackingtag/AdminAntTrackingTag.php
Normal file
@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
include_once(_PS_MODULE_DIR_.'/ant_trackingtag/ant_trackingtag.php');
|
||||
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
|
||||
|
||||
class AdminAntTrackingTag extends AdminTab
|
||||
{
|
||||
|
||||
protected $_html;
|
||||
public $module_name;
|
||||
public $config_tab;
|
||||
public $controller;
|
||||
public $helperForm;
|
||||
public $_object;
|
||||
|
||||
public function __construct($config_tab = true)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_object = false;
|
||||
$this->controller = 'AdminModules';
|
||||
$this->module_name = 'ant_trackingtag';
|
||||
$this->config_tab = (bool)$config_tab;
|
||||
if ($config_tab) {
|
||||
$this->controller = 'AdminAntTrackingTag';
|
||||
}
|
||||
$this->helperForm = new HelperFormBootstrap();
|
||||
$this->helperForm->_select2 = true;
|
||||
$this->helperForm->_inputSwitch = true;
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
$this->_html = '';
|
||||
|
||||
$this->_postProcess();
|
||||
|
||||
$this->_addCss();
|
||||
$this->_html .= $this->helperForm->renderStyle();
|
||||
|
||||
$this->_displayForm();
|
||||
$this->_displayList();
|
||||
|
||||
$this->_html .='<div class="clearfix"></div>';
|
||||
$this->_addJs();
|
||||
$this->_html .= $this->helperForm->renderScript();
|
||||
echo $this->_html;
|
||||
}
|
||||
|
||||
|
||||
protected function _addJs()
|
||||
{
|
||||
$this->helperForm->_js .= '<script type="text/javascript"></script>';
|
||||
}
|
||||
|
||||
protected function _addCss()
|
||||
{
|
||||
$this->helperForm->_css .='
|
||||
.table tr th {
|
||||
background: #565485;
|
||||
background: rgba(86,84,133,0.9);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
.table tr:nth-child(even) {
|
||||
background: #F1F1F1;
|
||||
}
|
||||
.table .input-group-btn .btn {
|
||||
padding: 4px 5px;
|
||||
color: #504d8b;
|
||||
|
||||
}
|
||||
.table .input-group-btn .btn .anticon{
|
||||
font-size: 12px;
|
||||
}
|
||||
.bg-grey{
|
||||
background: #EFEFEF;
|
||||
border-radius:4px;
|
||||
}
|
||||
.bg-grey .div-title {
|
||||
border-bottom: 2px solid #504D8B;
|
||||
}
|
||||
';
|
||||
}
|
||||
|
||||
protected function _displayList()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$id_lang = (int)$cookie->id_lang;
|
||||
|
||||
$tags = AntTrackingTag::getTags(false);
|
||||
$_current_index = ($this->config_tab ? $currentIndex . '&token=' . Tools::getAdminTokenLite($this->controller) : $_SERVER['REQUEST_URI']);
|
||||
|
||||
$this->_html .='
|
||||
<div class="col-md-12">
|
||||
<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2><span class="text-rose anticon anticon-list"></span> '.$this->l('Liste des tags').'</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<table class="table table-custombordered" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left">'.$this->l('ID').'</th>
|
||||
<th class="text-left">'.$this->l('Name').'</th>
|
||||
<th class="text-left">'.$this->l('tag').'</th>
|
||||
<th class="text-center">'.$this->l('Active').'</th>
|
||||
<th class="text-center">'.$this->l('Nb').'</th>
|
||||
<th class="text-center">'.$this->l('Total').'</th>
|
||||
<th class="text-center">'.$this->l('Action').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$customer_numbers = AntTrackingTag::getCountCustomerByTag((int)$tag['id_trackingtag']);
|
||||
$total = 0;
|
||||
|
||||
$this->_html .='
|
||||
<tr>
|
||||
<td valign="middle" align="left">#'.$tag['id_trackingtag'].'</td>
|
||||
<td valign="middle" align="left"><b>'.$tag['name'].'</b></td>
|
||||
<td valign="middle" align="left"><b>'.$tag['tag'].'</b></td>
|
||||
<td align="center">'.((int)$tag['enabled']?'<span class="anticon anticon-checkmark text-green-light"></span>':'<span class="anticon anticon-cross text-rose"></span>').'</td>
|
||||
<td valign="middle" align="center">';
|
||||
foreach ($customer_numbers as $info) {
|
||||
$total += (int)$info['nb'];
|
||||
$this->_html.='
|
||||
<button class="btn btn-primary btn-xs" type="button">
|
||||
'.$info['value'].' <span class="badge">'.$info['nb'].'</span>
|
||||
</button> ';
|
||||
}
|
||||
$this->_html.=
|
||||
'</td>
|
||||
<td valign="middle" align="center">'.$total.'</td>
|
||||
<td valign="middle" align="center">
|
||||
<div class="input-group-btn" role="group" aria-label="...">
|
||||
<a href="'.$_current_index.'&loadTag=1&id='.$tag['id_trackingtag'].'" class="btn btn-default"><span class="anticon anticon-pencil2"></span></a>
|
||||
<a href="'.$_current_index.'&deleteTag=1&id='.$tag['id_trackingtag'].'" class="btn btn-default"><span class="anticon anticon-bin"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
$this->_html .='
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
protected function _postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('newTag')) {
|
||||
|
||||
} elseif (Tools::isSubmit('addTag')) {
|
||||
$this->_addOrUpdateTag(false);
|
||||
} elseif (Tools::isSubmit('editTag')) {
|
||||
$this->_addOrUpdateTag(true);
|
||||
} elseif (Tools::isSubmit('loadTag') && Tools::getValue('id')) {
|
||||
$this->_object = new AntTrackingTag((int)Tools::getValue('id'));
|
||||
} elseif (Tools::isSubmit('deleteTag') && Tools::getValue('id')) {
|
||||
$deleted_group = new AntTrackingTag((int)Tools::getValue('id'));
|
||||
$res = $deleted_group->delete();
|
||||
if ($res) {
|
||||
$this->_html .= HelperFormBootstrap::displaySuccess($this->l('Tag deleted : #') . (int)Tools::getValue('id'));
|
||||
} else {
|
||||
$this->_html .= HelperFormBootstrap::displayError($this->l('Tag cannot be deleted : #') . (int)Tools::getValue('id'));
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _addOrUpdateTag($edit = false)
|
||||
{
|
||||
if ($edit) {
|
||||
$trackingTag = new AntTrackingTag((int)Tools::getValue('id_trackingtag'));
|
||||
} else {
|
||||
$trackingTag = new AntTrackingTag();
|
||||
}
|
||||
|
||||
$trackingTag->name = Tools::getValue('name');
|
||||
$trackingTag->tag = Tools::getValue('tag');
|
||||
$trackingTag->enabled = (int)Tools::getValue('enabled');
|
||||
|
||||
if ($trackingTag->save()) {
|
||||
if ($edit) {
|
||||
$this->_html .= HelperFormBootstrap::displaySuccess($this->l('Tag has been updated'));
|
||||
} else {
|
||||
$this->_html .= HelperFormBootstrap::displaySuccess($this->l('Tag has been created'));
|
||||
}
|
||||
} else {
|
||||
$this->_html .= HelperFormBootstrap::displayError($this->l('Error occured while updating tag'));
|
||||
}
|
||||
}
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
if (Validate::isLoadedObject($this->_object)){
|
||||
$trackingTag = $this->_object;
|
||||
}
|
||||
$this->helperForm->_forms = array(
|
||||
array(
|
||||
'action' => $currentIndex . '&token=' . Tools::getAdminTokenLite('AdminAntTrackingTag'),
|
||||
'title' => '<span class="text-rose glyphicon glyphicon-tags"></span> '.$this->l('Tag'),
|
||||
'class' => 'form-horizontal',
|
||||
'class_div' => 'col-md-12',
|
||||
'sections' => array(
|
||||
array(
|
||||
'class' => 'col-md-6',
|
||||
'inputs' => array(
|
||||
array(
|
||||
'type' => 'simpleText',
|
||||
'name' => 'name',
|
||||
'label-class' => 'col-md-5',
|
||||
'input-class' => 'col-md-6',
|
||||
'label' => $this->l('Name'),
|
||||
'default' => (isset($trackingTag)?$trackingTag->name:'')
|
||||
),
|
||||
array(
|
||||
'type' => 'simpleText',
|
||||
'name' => 'tag',
|
||||
'label-class' => 'col-md-5',
|
||||
'input-class' => 'col-md-6',
|
||||
'label' => $this->l('Tag'),
|
||||
'default' => (isset($trackingTag)?$trackingTag->tag:'')
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Active'),
|
||||
'label-class' => 'col-md-5',
|
||||
'input-class' => 'col-md-6',
|
||||
'class-group' => 'switch',
|
||||
'name' => 'enabled',
|
||||
'title' => ' ',
|
||||
'default' => (isset($trackingTag)?($trackingTag->enabled==0?0:1):1),
|
||||
'checked' => (isset($trackingTag)?($trackingTag->enabled==0?0:1):1),
|
||||
),
|
||||
),
|
||||
'actions' => array(),
|
||||
'actions-class' => 'text-right',
|
||||
),
|
||||
array(
|
||||
'class' => 'col-md-6 bg-grey',
|
||||
'title' => '<span class="anticon anticon-info"></span> Informations',
|
||||
'inputs' => array(),
|
||||
'info_html' => '
|
||||
<p>Les balises doivent être présentes dans l\'url et sont trackées à l\'inscription</p>
|
||||
<p>Le nouveau client est comptabilisé avec la valeur que contient la balise.<br>
|
||||
Par exemple :</p>
|
||||
<ul>
|
||||
<li style="font-size:13px;">url : www.bebeboutik.com/authentification?create_account=1&<b>ed=564</b></li>
|
||||
</ul>
|
||||
<p>Ici le client sera associé au tag <b>ed</b> qui aura pour valeur <b>564</b>.</p>
|
||||
<p>Le client est donc comptabilisé pour le tag <b>ed</b> et plus précisément pour la valeur <b>564</b> de ce tag.</p>
|
||||
<p><i class="glyphicon glyphicon-alert"></i> <i>Si plusieurs tags présents, le client sera comptabilisé dans tous les tags</i></p>
|
||||
<p></p>'
|
||||
),
|
||||
),
|
||||
'actions' => array(),
|
||||
'actions-class' => 'text-right',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (isset($trackingTag)) {
|
||||
$this->helperForm->_forms[0]['sections'][0]['title'] = "Editer le tag ".$trackinTag->name;
|
||||
$this->helperForm->_forms[0]['sections'][0]['inputs'][] = array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_trackingtag',
|
||||
'value' => $trackingTag->id,
|
||||
'class' => 'large'
|
||||
);
|
||||
$this->helperForm->_forms[0]['sections'][0]['actions'] = array(
|
||||
array(
|
||||
'type' => 'submit',
|
||||
'class' => 'btn-default',
|
||||
'name' => 'newTag',
|
||||
'value' => $this->l('Nouveau Tag')
|
||||
),
|
||||
array(
|
||||
'type' => 'submit',
|
||||
'class' => 'btn-primary',
|
||||
'name' => 'editTag',
|
||||
'value' => $this->l('Editer le Tag')
|
||||
),
|
||||
);
|
||||
} else {
|
||||
$this->helperForm->_forms[0]['sections'][0]['title'] = "Ajouter un tag";
|
||||
$this->helperForm->_forms[0]['sections'][0]['actions'] = array(
|
||||
array(
|
||||
'type' => 'submit',
|
||||
'class' => 'btn-primary',
|
||||
'name' => 'addTag',
|
||||
'value' => $this->l('Ajouter le tag')
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$this->helperForm->renderForm();
|
||||
}
|
||||
}
|
129
modules/ant_trackingtag/ant_trackingtag.php
Normal file
129
modules/ant_trackingtag/ant_trackingtag.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
include_once(_PS_MODULE_DIR_.'/ant_trackingtag/models/AntTrackingTag.php');
|
||||
|
||||
class Ant_Trackingtag extends Module {
|
||||
public function __construct() {
|
||||
$this->name = 'ant_trackingtag';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = '1.0';
|
||||
$this->author = 'Antadis';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->displayName = $this->l('Tracking Tag');
|
||||
$this->description = $this->l('Allows to track tags set in url');
|
||||
}
|
||||
|
||||
public function install() {
|
||||
|
||||
# Add tables
|
||||
$query = '
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ant_trackingtag` (
|
||||
`id_trackingtag` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`enabled` BOOL NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`tag` VARCHAR(255) NOT NULL,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
`date_upd` DATETIME NOT NULL,
|
||||
PRIMARY KEY(`id_trackingtag`)
|
||||
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
||||
';
|
||||
if(!Db::getInstance()->Execute($query)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = '
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ant_trackingtag_customer` (
|
||||
`id_trackingtag` INTEGER NOT NULL,
|
||||
`id_customer` INTEGER NOT NULL,
|
||||
`value` VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY(`id_trackingtag`, `id_customer`, `value`)
|
||||
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
||||
';
|
||||
if(!Db::getInstance()->Execute($query)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
# Register hooks
|
||||
if(!parent::install()
|
||||
|| !$this->registerHook('createAccount')
|
||||
|| !$this->registerHook('createAccountForm')
|
||||
|| !$this->registerHook('PrivateSales_Block')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall() {
|
||||
|
||||
if(parent::uninstall() == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'ant_trackingtag`');
|
||||
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'ant_trackingtag_customer`');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hookCreateAccount($params) {
|
||||
global $cookie;
|
||||
|
||||
$newCustomer = $params['newCustomer'];
|
||||
if(!Validate::isLoadedObject($newCustomer)) {
|
||||
return false;
|
||||
}
|
||||
if(Tools::getValue('trackingtags')){
|
||||
$id_tags = Tools::getValue('trackingtags');
|
||||
foreach ($id_tags as $id_tag => $value) {
|
||||
if(AntTrackingTag::isExistAndEnabled($id_tag)){
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'ant_trackingtag_customer`
|
||||
VALUES (
|
||||
'.$id_tag.',
|
||||
'.(int) $newCustomer->id.',
|
||||
"'.pSQL($value).'"
|
||||
)
|
||||
');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hookCreateAccountForm($params) {
|
||||
global $smarty, $cookie;
|
||||
|
||||
$tags = AntTrackingTag::getTags();
|
||||
$tracking_tags = [];
|
||||
foreach ($tags as $tag) {
|
||||
if($value = Tools::getValue($tag['tag'])) {
|
||||
$tracking_tags[(int)$tag['id_trackingtag']] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
'tracking_tags' => $tracking_tags,
|
||||
));
|
||||
return $this->display(__FILE__, 'authentication.tpl');
|
||||
}
|
||||
|
||||
public function hookPrivateSales_Block($params) {
|
||||
global $smarty, $cookie;
|
||||
|
||||
$tags = AntTrackingTag::getTags();
|
||||
$tracking_tags = [];
|
||||
foreach ($tags as $tag) {
|
||||
if($value = Tools::getValue($tag['tag'])) {
|
||||
$tracking_tags[(int)$tag['id_trackingtag']] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
'tracking_tags' => $tracking_tags,
|
||||
));
|
||||
}
|
||||
}
|
7
modules/ant_trackingtag/authentication.tpl
Normal file
7
modules/ant_trackingtag/authentication.tpl
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="hidden" style="display: none !important;">
|
||||
{if isset($tracking_tags) && !empty($tracking_tags)}
|
||||
{foreach from=$tracking_tags item=tracking_tag key=key}
|
||||
<input type="hidden" name="trackingtags[{$key}]" value="{$tracking_tag}" />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
116
modules/ant_trackingtag/models/AntTrackingTag.php
Normal file
116
modules/ant_trackingtag/models/AntTrackingTag.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
class AntTrackingTag extends ObjectModel
|
||||
{
|
||||
|
||||
public $id_trackingtag;
|
||||
public $enabled;
|
||||
public $name;
|
||||
public $tag;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
protected $fieldsRequired = array('name','tag');
|
||||
protected $fieldsValidate = array(
|
||||
'id_trackingtag' => 'isUnsignedId',
|
||||
'enabled' => 'isBool',
|
||||
'name' => 'isString',
|
||||
'tag' => 'isString',
|
||||
'date_add' => 'isDate',
|
||||
'date_upd' => 'isDate',
|
||||
);
|
||||
|
||||
protected $table = 'ant_trackingtag';
|
||||
protected $identifier = 'id_trackingtag';
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
parent::validateFields();
|
||||
|
||||
$fields['id_trackingtag'] = (int)$this->id_trackingtag;
|
||||
$fields['enabled'] = (int)$this->enabled;
|
||||
$fields['name'] = pSQL($this->name);
|
||||
$fields['tag'] = pSQL($this->tag);
|
||||
$fields['date_add'] = pSQL($this->date_add);
|
||||
$fields['date_upd'] = pSQL($this->date_upd);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get demands
|
||||
* @param $states array get only demands in specific states
|
||||
* @return Array Groups
|
||||
*/
|
||||
public static function getTags($enabled = true, $where = false)
|
||||
{
|
||||
if($where){
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'ant_trackingtag` tt
|
||||
WHERE '.$where.'
|
||||
'.($enabled ? ' AND tt.`enabled` = 1' : '').'
|
||||
');
|
||||
} else {
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'ant_trackingtag` tt
|
||||
WHERE 1
|
||||
'.($enabled ? ' AND tt.`enabled` = 1' : '').'
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
public function save($nullValues = false, $autodate = true)
|
||||
{
|
||||
if (parent::save($nullValues,$autodate)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getTagByName($name)
|
||||
{
|
||||
return Db::getInstance()->getValue("
|
||||
SELECT `id_trackingtag`
|
||||
FROM `"._DB_PREFIX_."ant_trackingtag`
|
||||
WHERE `name` = " .pSQL($name)
|
||||
);
|
||||
}
|
||||
|
||||
public static function isExistAndEnabled($id_trackingtag)
|
||||
{
|
||||
return Db::getInstance()->getValue("
|
||||
SELECT `id_trackingtag`
|
||||
FROM `"._DB_PREFIX_."ant_trackingtag`
|
||||
WHERE `id_trackingtag` = " .pSQL($id_trackingtag)."
|
||||
AND `enabled`=1"
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCountCustomerByTag($id_trackingtag)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS("
|
||||
SELECT COUNT(id_customer) as `nb`, `value`
|
||||
FROM `"._DB_PREFIX_."ant_trackingtag_customer`
|
||||
WHERE `id_trackingtag` = " . (int)$id_trackingtag."
|
||||
GROUP BY `value`"
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCustomer($id_trackingtag)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS("
|
||||
SELECT c.*
|
||||
FROM `" . _DB_PREFIX_ . "customer` c
|
||||
LEFT JOIN `" . _DB_PREFIX_ . "ant_trackingtag_customer` t ON (t.id_customer = c.id_customer)
|
||||
WHERE sd.`id_trackingtag` = " . (int)$id_trackingtag
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,35 +4,47 @@ include(dirname(__FILE__).'/../../init.php');
|
||||
|
||||
if(($sponsor = Tools::getValue('sponsor')) && strlen($sponsor) > 12) {
|
||||
|
||||
setcookie('554b43403edef30d31412286d5098965', $sponsor, time() + 3600 * 24 * 365, '/', '.bebeboutik.com');
|
||||
setcookie('554b43403edef30d31412286d5098965', $sponsor, time() + 3600 * 24 * 365, '/', '.bebeboutik.com');
|
||||
|
||||
$email = base64_decode(strrev(substr($sponsor, 12)));
|
||||
if(count(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_customer`
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `email` = "'.pSQL($email).'"
|
||||
')) > 0) {
|
||||
if(Configuration::get('PS_CIPHER_ALGORITHM')) {
|
||||
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||
} else {
|
||||
$cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
|
||||
}
|
||||
$email = base64_decode(strrev(substr($sponsor, 12)));
|
||||
if(count(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_customer`
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `email` = "'.pSQL($email).'"
|
||||
')) > 0) {
|
||||
if(Configuration::get('PS_CIPHER_ALGORITHM')) {
|
||||
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||
} else {
|
||||
$cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
|
||||
}
|
||||
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$gclid = Tools::getIsset('gclid')?'&gclid='.Tools::getValue('gclid'):'';
|
||||
if(Tools::getIsset('lpes')) {
|
||||
$lp = Tools::getValue('lpes');
|
||||
if( _THEME_NAME_ !== 'site_mobile') {
|
||||
Tools::redirect('?sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($lp)? '&lpes='.$lp: '').$gclid);
|
||||
}
|
||||
}
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$gclid = Tools::getIsset('gclid')?'&gclid='.Tools::getValue('gclid'):'';
|
||||
if(Tools::getIsset('lpes')) {
|
||||
$lp = Tools::getValue('lpes');
|
||||
if( _THEME_NAME_ !== 'site_mobile') {
|
||||
Tools::redirect('?sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($lp)? '&lpes='.$lp: '').$gclid);
|
||||
}
|
||||
}
|
||||
|
||||
if(Tools::getIsset('lp')) {
|
||||
$lp = Tools::getValue('lp');
|
||||
}
|
||||
Tools::redirectLink($link->getPageLink('authentication.php').'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($url['query'])? '&'.$url['query']: '').(isset($lp)? '&lp='.$lp: '').$gclid);
|
||||
// Tools::redirectLink($link->getPageLink('authentication.php').'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($url['query'])? '&'.$url['query']: ''));
|
||||
}
|
||||
if(Tools::getIsset('lp')) {
|
||||
$lp = Tools::getValue('lp');
|
||||
}
|
||||
|
||||
if(!class_exists('AntTrackingTag')){
|
||||
include_once(_PS_MODULE_DIR_.'/ant_trackingtag/models/AntTrackingTag.php');
|
||||
}
|
||||
$tags = AntTrackingTag::getTags();
|
||||
$url_tag ='';
|
||||
foreach ($tags as $tag) {
|
||||
if(Tools::getIsset($tag['tag'])) {
|
||||
$value = Tools::getValue($tag['tag']);
|
||||
$url_tag .='&'.$tag['tag'].'='.$value;
|
||||
}
|
||||
}
|
||||
Tools::redirectLink($link->getPageLink('authentication.php').'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($url['query'])? '&'.$url['query']: '').(isset($lp)? '&lp='.$lp: '').$url_tag.$gclid);
|
||||
// Tools::redirectLink($link->getPageLink('authentication.php').'?create_account=1&sponsor='.rawurlencode($cipherTool->encrypt('1|'.$email.'|')).(isset($url['query'])? '&'.$url['query']: ''));
|
||||
}
|
||||
}
|
||||
|
||||
Tools::redirect();
|
||||
|
@ -40,6 +40,14 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="hidden" style="display: none !important;">
|
||||
{if isset($tracking_tags) && !empty($tracking_tags)}
|
||||
{foreach from=$tracking_tags item=tracking_tag key=key}
|
||||
<input type="hidden" name="trackingtags[{$key}]" value="{$tracking_tag}" />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
{if isset($newsletter) && $newsletter}
|
||||
<p class="checkbox" >
|
||||
|
Loading…
Reference in New Issue
Block a user