48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Permet de réaffecter des clients au tracking
|
|
*/
|
|
|
|
/**
|
|
* Historique retroallocation
|
|
*
|
|
* 12/01/2016
|
|
* id_tracking : 9 - affiliaton-adlead
|
|
* id_sponsor : 377
|
|
* id_customer (limit) : 114324
|
|
* ---------------------------------
|
|
* 21/01/2016
|
|
* id_tracking : id - cliclead-juillet15
|
|
* id_sponsor : 94440
|
|
*
|
|
*/
|
|
include(dirname(__FILE__).'/../../config/config.inc.php');
|
|
|
|
include(dirname(__FILE__).'/antadismarketing.php');
|
|
|
|
/*$tracking_name = "affiliaton-adlead";*/
|
|
$tracking_name = "cliclead-juillet15";
|
|
$tracking = AntTracking::getTrackingInfo($tracking_name);
|
|
$id_sponsor = 94440;
|
|
|
|
if(Validate::isLoadedObject($tracking)) {
|
|
$customers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
|
SELECT c.`id_customer`, rp.`id_sponsor`
|
|
FROM '. _DB_PREFIX_ .'customer c
|
|
LEFT JOIN '. _DB_PREFIX_ .'referralprogram rp ON (rp.`id_customer` = c.`id_customer` AND rp.`id_sponsor` = ' . (int) $id_sponsor . ')
|
|
WHERE rp.`id_customer` IS NOT NULL
|
|
-- AND c.`id_customer` < 114324
|
|
AND rp.`id_customer` NOT IN (
|
|
SELECT amtu.`id_customer`
|
|
FROM '. _DB_PREFIX_ .'ant_marketing_tracking_users amtu
|
|
-- WHERE amtu.`id_tracking` = '.(int)$tracking->id_tracking.'
|
|
WHERE 1
|
|
)
|
|
');
|
|
echo "<pre>";var_dump($customers);echo "</pre>";die();
|
|
|
|
/*foreach ($customers as $customer) {
|
|
$tracking->addSubscribe((int)$customer['id_customer']);
|
|
}*/
|
|
}
|
|
exit; |