add module criteo_bbb

This commit is contained in:
Marion Muszynski 2016-07-25 16:40:22 +02:00
parent 2b9fd29308
commit fe32da2f12
30 changed files with 1796 additions and 0 deletions

View File

@ -0,0 +1,347 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if ((bool)Configuration::get('PS_MOBILE_DEVICE'))
require_once(_PS_MODULE_DIR_ . '/mobile_theme/Mobile_Detect.php');
// Retro 1.3, 'class_exists' cause problem with autoload...
if (version_compare(_PS_VERSION_, '1.4', '<'))
{
// Not exist for 1.3
class Shop extends ObjectModel
{
public $id = 1;
public $id_shop_group = 1;
public function __construct()
{
}
public static function getShops()
{
return array(
array('id_shop' => 1, 'name' => 'Default shop')
);
}
public static function getCurrentShop()
{
return 1;
}
}
class Logger
{
public static function AddLog($message, $severity = 2)
{
$fp = fopen(dirname(__FILE__).'/../logs.txt', 'a+');
fwrite($fp, '['.(int)$severity.'] '.Tools::safeOutput($message));
fclose($fp);
}
}
}
// Not exist for 1.3 and 1.4
class Context
{
/**
* @var Context
*/
protected static $instance;
/**
* @var Cart
*/
public $cart;
/**
* @var Customer
*/
public $customer;
/**
* @var Cookie
*/
public $cookie;
/**
* @var Link
*/
public $link;
/**
* @var Country
*/
public $country;
/**
* @var Employee
*/
public $employee;
/**
* @var Controller
*/
public $controller;
/**
* @var Language
*/
public $language;
/**
* @var Currency
*/
public $currency;
/**
* @var AdminTab
*/
public $tab;
/**
* @var Shop
*/
public $shop;
/**
* @var Smarty
*/
public $smarty;
/**
* @ var Mobile Detect
*/
public $mobile_detect;
/**
* @var boolean|string mobile device of the customer
*/
protected $mobile_device;
public function __construct()
{
global $cookie, $cart, $smarty, $link;
$this->tab = null;
$this->cookie = $cookie;
$this->cart = $cart;
$this->smarty = $smarty;
$this->link = $link;
$this->controller = new ControllerBackwardModule();
if (is_object($cookie))
{
$this->currency = new Currency((int)$cookie->id_currency);
$this->language = new Language((int)$cookie->id_lang);
$this->country = new Country((int)$cookie->id_country);
$this->customer = new CustomerBackwardModule((int)$cookie->id_customer);
$this->employee = new Employee((int)$cookie->id_employee);
}
else
{
$this->currency = null;
$this->language = null;
$this->country = null;
$this->customer = null;
$this->employee = null;
}
$this->shop = new ShopBackwardModule();
if ((bool)Configuration::get('PS_MOBILE_DEVICE'))
$this->mobile_detect = new Mobile_Detect();
}
public function getMobileDevice()
{
if (is_null($this->mobile_device))
{
$this->mobile_device = false;
if ($this->checkMobileContext())
{
switch ((int)Configuration::get('PS_MOBILE_DEVICE'))
{
case 0: // Only for mobile device
if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet())
$this->mobile_device = true;
break;
case 1: // Only for touchpads
if ($this->mobile_detect->isTablet() && !$this->mobile_detect->isMobile())
$this->mobile_device = true;
break;
case 2: // For touchpad or mobile devices
if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet())
$this->mobile_device = true;
break;
}
}
}
return $this->mobile_device;
}
protected function checkMobileContext()
{
return isset($_SERVER['HTTP_USER_AGENT'])
&& (bool)Configuration::get('PS_MOBILE_DEVICE')
&& !Context::getContext()->cookie->no_mobile;
}
/**
* Get a singleton context
*
* @return Context
*/
public static function getContext()
{
if (!isset(self::$instance))
self::$instance = new Context();
return self::$instance;
}
/**
* Clone current context
*
* @return Context
*/
public function cloneContext()
{
return clone($this);
}
/**
* @return int Shop context type (Shop::CONTEXT_ALL, etc.)
*/
public static function shop()
{
if (!self::$instance->shop->getContextType())
return ShopBackwardModule::CONTEXT_ALL;
return self::$instance->shop->getContextType();
}
}
/**
* Class Shop for Backward compatibility
*/
class ShopBackwardModule extends Shop
{
const CONTEXT_ALL = 1;
public $id = 1;
public $id_shop_group = 1;
public function getContextType()
{
return ShopBackwardModule::CONTEXT_ALL;
}
// Simulate shop for 1.3 / 1.4
public function getID()
{
return 1;
}
/**
* Get shop theme name
*
* @return string
*/
public function getTheme()
{
return _THEME_NAME_;
}
public function isFeatureActive()
{
return false;
}
}
/**
* Class Controller for a Backward compatibility
* Allow to use method declared in 1.5
*/
class ControllerBackwardModule
{
/**
* @param $js_uri
* @return void
*/
public function addJS($js_uri)
{
Tools::addJS($js_uri);
}
/**
* @param $css_uri
* @param string $css_media_type
* @return void
*/
public function addCSS($css_uri, $css_media_type = 'all')
{
Tools::addCSS($css_uri, $css_media_type);
}
public function addJquery()
{
if (_PS_VERSION_ < '1.5')
$this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js');
elseif (_PS_VERSION_ >= '1.5')
$this->addJS(_PS_JS_DIR_.'jquery/jquery-1.7.2.min.js');
}
}
/**
* Class Customer for a Backward compatibility
* Allow to use method declared in 1.5
*/
class CustomerBackwardModule extends Customer
{
public $logged = false;
/**
* Check customer informations and return customer validity
*
* @since 1.5.0
* @param boolean $with_guest
* @return boolean customer validity
*/
public function isLogged($with_guest = false)
{
if (!$with_guest && $this->is_guest == 1)
return false;
/* Customer is valid only if it can be load and if object password is the same as database one */
if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd))
return true;
return false;
}
}

View File

@ -0,0 +1,48 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* Class allow to display tpl on the FO
*/
class BWDisplay extends FrontController
{
// Assign template, on 1.4 create it else assign for 1.5
public function setTemplate($template)
{
if (_PS_VERSION_ >= '1.5')
parent::setTemplate($template);
else
$this->template = $template;
}
// Overload displayContent for 1.4
public function displayContent()
{
parent::displayContent();
echo Context::getContext()->smarty->fetch($this->template);
}
}

View File

@ -0,0 +1 @@
version = 0.4

View File

@ -0,0 +1,55 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* Backward function compatibility
* Need to be called for each module in 1.4
*/
// Get out if the context is already defined
if (!in_array('Context', get_declared_classes()))
require_once(dirname(__FILE__).'/Context.php');
// Get out if the Display (BWDisplay to avoid any conflict)) is already defined
if (!in_array('BWDisplay', get_declared_classes()))
require_once(dirname(__FILE__).'/Display.php');
// If not under an object we don't have to set the context
if (!isset($this))
return;
else if (isset($this->context))
{
// If we are under an 1.5 version and backoffice, we have to set some backward variable
if (_PS_VERSION_ >= '1.5' && isset($this->context->employee->id) && $this->context->employee->id && isset(AdminController::$currentIndex) && !empty(AdminController::$currentIndex))
{
global $currentIndex;
$currentIndex = AdminController::$currentIndex;
}
return;
}
$this->context = Context::getContext();
$this->smarty = $this->context->smarty;

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

View File

@ -0,0 +1,616 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @version 2.6
* @uses Prestashop modules
* @since 1.0 - 22 juillet 2013
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
if (!defined('_PS_VERSION_'))
exit;
class Criteo_bbb extends Module
{
public function __construct()
{
$this->name = 'criteo_bbb';
$this->tab = 'advertising_marketing';
$this->version = '2.6';
$this->need_instance = 0;
$this->author = 'Web In Color';
parent::__construct();
$this->displayName = $this->l('Criteo');
$this->description = $this->l('Criteo product export and tag display.');
/* Backward compatibility */
if (version_compare(_PS_VERSION_, '1.5', '<'))
require(_PS_MODULE_DIR_.$this->name.'/backward_compatibility/backward.php');
}
public function install()
{
return (parent::install());/* && $this->registerHook('header')
&& $this->registerHook('productfooter')
&& $this->registerHook('home')
&& $this->registerHook('shoppingCartExtra')
&& $this->registerHook('footer')
&& $this->registerHook('orderConfirmation'));*/
}
private function postProcess()
{
if (Tools::isSubmit('submitCriteo'))
{
if (!Tools::getValue('id_criteo_account'))
return $this->displayError($this->l('All fields required'));
Configuration::updateValue('WIC_CRITEO_ID_ACCOUNT', pSQL(Tools::getValue('id_criteo_account')));
Configuration::updateValue('WIC_CRITEO_SITE_TYPE', pSQL(Tools::getValue('site_type_criteo')));
Configuration::updateValue('WIC_CRITEO_CATEGORY', (Tools::getValue('category') ? implode(',', Tools::getValue('category')) : ''));
Configuration::updateValue('WIC_CRITEO_DISPLAY_CAT', Tools::getValue('display_category_criteo'));
return $this->displayConfirmation($this->l('Settings updated successfully'));
}
return false;
}
public function getContent()
{
if (version_compare(_PS_VERSION_, '1.4', '>='))
$this->_html = '<link type="text/css" rel="stylesheet" href="'.$this->_path.'css/admin.css" />';
else
$this->_html = '<link type="text/css" rel="stylesheet" href="'.$this->_path.'css/admin_backward.css" />';
//$this->_html .= '<div class="toolbar-placeholder"><div class="toolbarBox toolbarHead"><div class="pageTitle"><h3> <span id="current_obj" style="font-weight: normal;"> <span class="breadcrumb item-0 "><img src="'.$this->_path.'img/logo_webincolor_L260.png" width="260" height="70"/>'.$this->l('Expertise e-commerce Prestashop').'</span> </span></h3><span class="readme"><img src="'.$this->_path.'img/PDF.png" width="32" height="32"/><a href="http://www.webincolor.fr/addons_prestashop/'.$this->l('criteo_en.pdf').'" target="_blank">'.$this->l('Download the documentation').'</a></span></div></div><div class="leadin"></div></div>';
if (version_compare(_PS_VERSION_, '1.5', '<='))
$this->_html .= '<script type="text/javascript" src="'.$this->_path.'js/toolbar.js"></script>';
$this->_html .= $this->postProcess();
$this->_html .= '
<fieldset>
<legend><img src="'.$this->_path.'logo.gif" alt="" title=""/> '.$this->l('Criteo Export').'</legend>
<form method="post" action="" name="criteoForm" id="criteo-wrapper">
<div class="warn alert alert-warning">
<span style="float:right">
<a id="hideWarn" href=""><img alt="X" src="../img/admin/close.png"></a>
</span>
<ul style="margin-top: 3px">
<li>'.$this->l('URL to communicate to Criteo:');
if (version_compare(_PS_VERSION_, '1.5', '>='))
{
$shops = Shop::getShops();
foreach ($shops as $shop)
$this->_html .= ' <a href="'.Tools::getProtocol().$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/'.$this->name.'/tools/export_xml.php?token='.sha1(_COOKIE_KEY_.'exportCriteo').'">'.Tools::getProtocol().$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/'.$this->name.'/tools/export_xml.php?id_shop='.$shop['id_shop'].'&token='.sha1(_COOKIE_KEY_.'exportCriteo').'</a></li>';
}
else
$this->_html .= ' <a href="'.Tools::getProtocol().$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/'.$this->name.'/tools/export_xml.php?token='.sha1(_COOKIE_KEY_.'exportCriteo').'">'.Tools::getProtocol().$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/'.$this->name.'/tools/export_xml.php?token='.sha1(_COOKIE_KEY_.'exportCriteo').'</a></li>';
$this->_html .= '</ul>
</div>
<label for="id_normal_criteo">'.$this->l('Criteo ID account').' :</label>
<input type="text" value="'.(Configuration::get('WIC_CRITEO_ID_ACCOUNT') ? Configuration::get('WIC_CRITEO_ID_ACCOUNT') : '').'" name="id_criteo_account" /><br /><br />
<label for="site_type_criteo">'.$this->l('Site type').' :</label>
<select name="site_type_criteo">
<option value="d" '.(Configuration::get('WIC_CRITEO_SITE_TYPE') == 'd' ? 'selected=selected' : '').'>'.$this->l('Classic website').'</option>
<option value="m" '.(Configuration::get('WIC_CRITEO_SITE_TYPE') == 'm' ? 'selected=selected' : '').'>'.$this->l('Mobile website').'</option>
<option value="t" '.(Configuration::get('WIC_CRITEO_SITE_TYPE') == 't' ? 'selected=selected' : '').'>'.$this->l('tablet website').'</option>
</select><br/><br/>
<label for="display_category_criteo">'.$this->l('Display Category produt in XML flow').' :</label>
<input type="radio" value="0" name="display_category_criteo" '.(Configuration::get('WIC_CRITEO_DISPLAY_CAT') ? '' : 'checked=checked').' />&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="1" name="display_category_criteo" '.(Configuration::get('WIC_CRITEO_DISPLAY_CAT') ? 'checked=checked' : '').' />&nbsp;&nbsp;Yes
<br/><br/>';
/*
<div class="row">
<div class="warn alert alert-warning">
<ul style="margin-top: 3px">
<li>'.$this->l('You can exclude categories, so that the products are not present.').'</li>
<li><strong>'.$this->l('Warning !').'</strong> '.$this->l('Products with the default category is selected below will not be exported.').'</li>
</ul>
</div>
<table style="width: 32em;float:left;"><tr><td>
<h4>'.$this->l('Category filter').'</h4>
<table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;">
<tr>
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'category[]\', this.checked)" /></th>
<th>'.$this->l('ID').'</th>
<th>'.$this->l('Name').'</th>
</tr>';
$done = array();
$index = array();
$indexed_categories = explode(',', Configuration::get('WIC_CRITEO_CATEGORY'));
$categories = Category::getCategories((int)$this->context->language->id, false);
foreach ($indexed_categories as $k => $row)
$index[] = $row;
$this->recurseCategoryForInclude($index, $categories, $categories[0][1], 1, null, $done);
$this->_html .= '</table>
<p style="padding:0px; margin:0px 0px 10px 0px; color: #7F7F7F;font-size: 0.85em;"><i>'.$this->l('Mark all checkbox(es) of categories to which the product are not in data XML flow').'<sup> *</sup></i></p>
</td></tr>
</table>
</div>*/
$this->_html .= '<br clear="all" />
<div>
<center class="submit"><input type="submit" class="button" name="submitCriteo" value="'.$this->l('Submit').'" class="button" /></center>
</div>
</form>
</fieldset>';
//$this->_html .= '<iframe src="http://www.webincolor.fr/addons_prestashop.html" width="670" height="430" border="0"></iframe>';
return $this->_html;
}
/* Build a categories tree
*
* @param array $indexed_categories Array with categories where product is indexed (in order to check checkbox)
* @param array $categories Categories to list
* @param array $current Current category
* @param integer $id_category Current category id
*/
private function recurseCategoryForInclude($indexed_categories, $categories, $current, $id_category = 1, $id_category_default = null, $has_suite = array(), $done = array())
{
static $irow;
if (!isset($done[$current['infos']['id_parent']]))
$done[$current['infos']['id_parent']] = 0;
$done[$current['infos']['id_parent']] += 1;
$todo = count($categories[$current['infos']['id_parent']]);
$done_c = $done[$current['infos']['id_parent']];
$level = $current['infos']['level_depth'] + 1;
$this->_html .= '
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
<td>
<input type="checkbox" name="category[]" class="categoryBox'.($id_category_default != null ? ' id_category_default' : '').'" id="category_'.$id_category.'" value="'.$id_category.'"'.(((in_array($id_category, $indexed_categories) || ((int)Tools::getValue('id_category') == $id_category)) || Tools::getIsset('adddiscount')) ? ' checked="checked"' : '').' />
</td>
<td>
'.$id_category.'
</td>
<td>';
if (version_compare(_PS_VERSION_, '1.4', '>='))
{
for ($i = 2; $i < $level; $i++)
$this->_html .= '<img src="../img/admin/lvl_'.(isset($has_suite[$i - 2]) ? '' : '1').'.gif" alt="" style="vertical-align:middle!important;" />';
$this->_html .= '<img src="../img/admin/'.($level == 1 ? 'lv1.gif' : 'lv2_'.($todo == $done_c ? 'f' : 'b').'.gif').'" alt="" style="vertical-align:middle!important;" /> &nbsp;
<label for="category_'.$id_category.'" class="t">'.$current['infos']['name'].'</label>';
}
else
{
$img = $level == 1 ? 'lv1.gif' : 'lv'.$level.'_'.($todo == $done_c ? 'f' : 'b').'.gif';
$this->_html .= '<img src="../img/admin/'.$img.'" alt="" style="vertical-align:middle!important;" /> &nbsp;<label for="category_'.$id_category.'" class="t">'.$current['infos']['name'].'</label>';
}
$this->_html .= '</td>
</tr>';
if ($level > 1)
$has_suite[] = ($todo == $done_c ? 0 : 1);
if (isset($categories[$id_category]))
foreach ($categories[$id_category] as $key => $row)
if ($key != 'infos')
$this->recurseCategoryForInclude($indexed_categories, $categories, $categories[$id_category][$key], $key, $has_suite, $done);
}
public function buildXML($id_shop=0)
{
set_time_limit(300);
$html = '<?xml version="1.0" encoding="UTF-8"?>'."\n".'<products>'."\n";
/* First line, columns */
$columns = array('id', 'name', 'smallimage', 'bigimage', 'producturl', 'description', 'price', 'retailprice', 'discount', 'recommendable', 'instock');
/* Setting parameters */
$conf = Configuration::getMultiple(array(
'PS_LANG_DEFAULT'));
$id_lang = (int)$conf['PS_LANG_DEFAULT'];
/* Searching for products */
$result = Db::getInstance()->executeS('
SELECT DISTINCT p.`id_product`, i.`id_image`, psl.`description` as `ps_description`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON p.`id_product` = c.`id_product`
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.id_product = p.id_product)
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.id_product = p.id_product)
LEFT JOIN `'._DB_PREFIX_.'privatesale` ps ON psc.`id_sale` = ps.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_site_version` psv ON psv.`id_sale` = ps.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_lang` psl ON psl.`id_sale` = ps.`id_sale`
WHERE ps.`date_start` < NOW()
AND ps.`date_end` > NOW()
AND ps.`enabled` = 1
AND ps.`id_sale` IS NOT NULL
AND psv.`version` = "fr"
AND p.`active` = 1
AND i.id_image IS NOT NULL
AND psl.`id_lang` = '.(int) $id_lang.'
ORDER BY ps.`id_sale`
');
foreach ($result as $k => $row)
{
if (Pack::isPack((int)$row['id_product']))
continue;
$product = new Product((int)$row['id_product'], true);
if (Validate::isLoadedObject($product))
{
$imageObj = Product::getCover((int)$product->id);
$line = array();
$line[] = htmlentities($product->name[$id_lang]);
$line[] = $this->context->link->getImageLink($product->link_rewrite[$id_lang], (version_compare(_PS_VERSION_, '1.5', '>=') ? $imageObj['id_image'] : $product->id.'-'.$imageObj['id_image']), (version_compare(_PS_VERSION_, '1.5', '>=')?ImageType::getFormatedName('small'):'small'));
$line[] = $this->context->link->getImageLink($product->link_rewrite[$id_lang], (version_compare(_PS_VERSION_, '1.5', '>=') ? $imageObj['id_image'] : $product->id.'-'.$imageObj['id_image']), (version_compare(_PS_VERSION_, '1.5', '>=')?ImageType::getFormatedName('small'):'thickbox'));
$line[] = $this->context->link->getProductLink((int)$product->id, $product->link_rewrite[$id_lang], $product->ean13).'?utm_source=criteo&aff=criteo';
$line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($row['ps_description'], ENT_COMPAT, 'UTF-8')));
$price = $product->getPrice(true, (int)Product::getDefaultAttribute($product->id));
if ($product->getPrice(true, (int)Product::getDefaultAttribute((int)$product->id), 6, null, false, false)) {
$val = $product->getPrice(true, (int)Product::getDefaultAttribute((int)$product->id), 6, null, false, false);
} else {
$val = 1;
}
$line[] = number_format($price, 2, '.', '');
$line[] = number_format($product->getPrice(true, (int)Product::getDefaultAttribute((int)$product->id), 6, null, false, false), 2, '.', '');
$line[] = number_format($product->getPrice(true, null, 2, null, true) * 100 / $val, 2, '.', '');
$line[] = '1';
$line[] = '1';
$cpt_xml = 1;
$html .= "\t".'<product id="'.$product->id.'">'."\n";
foreach ($line as $column)
{
$html .= "\t\t".'<'.$columns[$cpt_xml].'>'.$column.'</'.$columns[$cpt_xml].'>'."\n";
$cpt_xml++;
}
if (Configuration::get('WIC_CRITEO_DISPLAY_CAT'))
{
$categories = Product::getProductCategoriesFull((int)$product->id, $id_lang);
if ($categories)
{
$i = 1;
foreach ($categories as $category)
{
$html .= '<category_'.$i.'>'.$category['name'].'</category_'.$i.'>'."\n";
$i++;
}
}
}
$html .= "\t".'</product>'."\n";
}
}
$html .= '</products>'."\n";
echo $html;
}
public function fetchTemplate($path, $name, $extension = false)
{
return $this->display(__FILE__, $path.$name.'.'.($extension ? $extension : 'tpl'));
}
public function hookProductFooter($params)
{
global $site_version;
if(!isset($site_version) || $site_version != 'fr') {
return;
}
if (!Configuration::get('WIC_CRITEO_ID_ACCOUNT') || !Configuration::get('WIC_CRITEO_SITE_TYPE')) {
return false;
}
if ($this->context->customer && $this->context->customer->id) {
$email = $this->context->customer->email;
} else {
$email = '';
}
$this->context->smarty->assign(array(
'wic_criteo_account' => Configuration::get('WIC_CRITEO_ID_ACCOUNT'),
'wic_criteo_site_type' => Configuration::get('WIC_CRITEO_SITE_TYPE'),
'wic_product_id' => (int) Tools::getValue('id_product'),
'wic_action' => 'productFooter',
'id_customer' => $this->context->customer? $this->context->customer->id: 0,
'customer_email' => ($email) ? md5($email) : '',
'is_newsletter' => isset($_COOKIE['emst']) || (bool) Tools::getValue('emst'),
));
return $this->fetchTemplate('/views/templates/hooks/', 'criteo');
}
public function hookShoppingCartExtra($params)
{
global $site_version;
if(!isset($site_version) || $site_version != 'fr') {
return;
}
if (!Configuration::get('WIC_CRITEO_ID_ACCOUNT') || !Configuration::get('WIC_CRITEO_SITE_TYPE'))
return false;
$strproducts = '';
$id_products = array();
foreach($params['products'] as $product) {
$id_products[] = (int) $product['id_product'];
}
$products_sales = array();
foreach(Db::getInstance()->ExecuteQ('
SELECT `id_product`, `id_sale`
FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_product` IN ('.implode(', ', $id_products).')
AND `id_sale` != 0
') as $row) {
$products_sales[(int) $row['id_product']] = (int) $row['id_sale'];
}
if(count($products_sales) == 0) {
return;
}
$product_result = array();
foreach ($params['products'] as $product) {
if(isset($products_sales[(int) $product['id_product']])) {
if(!isset($product_result[$products_sales[(int) $product['id_product']]])) {
$product_result[$products_sales[(int) $product['id_product']]] = 0;
}
$product_obj = new Product((int)$product['id_product']);
$price = $product_obj->getPrice(true, ($product['id_product_attribute'] ? $product['id_product_attribute'] : (int)Product::getDefaultAttribute($product_obj->id)), 2);
$product_result[$products_sales[(int) $product['id_product']]] += $price * (int) $product['quantity'];
unset($product_obj);
}
}
foreach($product_result as $id_product => $value) {
$strproducts .= '{ id: '.$id_product.', price: '.$value.', quantity: 1 },';
}
$strproducts = Tools::substr($strproducts, 0, -1);
if ($this->context->customer && $this->context->customer->id) {
$email = $this->context->customer->email;
} else {
$email = '';
}
$this->context->smarty->assign(array(
'wic_criteo_account' => Configuration::get('WIC_CRITEO_ID_ACCOUNT'),
'wic_criteo_site_type' => Configuration::get('WIC_CRITEO_SITE_TYPE'),
'wic_product_list' => rtrim($strproducts, ','),
'wic_action' => 'shoppingCart',
'id_customer' => $this->context->customer? $this->context->customer->id: 0,
'customer_email' => ($email) ? md5($email) : '',
'is_newsletter' => isset($_COOKIE['emst']) || (bool) Tools::getValue('emst'),
));
return $this->fetchTemplate('/views/templates/hooks/', 'criteo');
}
public function hookNewOrder($params) {
return $this->hookOrderConfirmation($params);
}
public function hookOrderConfirmation($params)
{
global $site_version;
if(!isset($site_version) || $site_version != 'fr') {
return;
}
if (!Configuration::get('WIC_CRITEO_ID_ACCOUNT') || !Configuration::get('WIC_CRITEO_SITE_TYPE')) {
return false;
}
if(isset($params['objOrder'])) {
$cart = new Cart((int)$params['objOrder']->id_cart);
} elseif(isset($params['cart']) && Validate::isLoadedObject($params['cart'])) {
$cart = $params['cart'];
} else {
return;
}
$products = $cart->getProducts();
$strproducts = '';
$id_products = array();
foreach ($products as $product) {
$id_products[] = (int) $product['id_product'];
}
$products_sales = array();
foreach(Db::getInstance()->ExecuteQ('
SELECT `id_product`, `id_sale`
FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_product` IN ('.implode(', ', $id_products).')
AND `id_sale` != 0
') as $row) {
$products_sales[(int) $row['id_product']] = (int) $row['id_sale'];
}
if(count($products_sales) == 0) {
return;
}
$product_result = array();
foreach ($products as $product) {
if(isset($products_sales[$product['id_product']])) {
if(!isset($product_result[$products_sales[$product['id_product']]])) {
$product_result[$products_sales[$product['id_product']]] = 0;
}
$product_obj = new Product((int)$product['id_product']);
$price = $product_obj->getPrice(true, ($product['id_product_attribute'] ? $product['id_product_attribute'] : (int)Product::getDefaultAttribute($product_obj->id)), 2);
$product_result[$products_sales[$product['id_product']]] += $price * (int) $product['quantity'];
unset($product_obj);
}
}
foreach($product_result as $id_product => $value) {
$strproducts .= '{ id: '.$id_product.', price: '.$value.', quantity: 1 },';
}
$strproducts = Tools::substr($strproducts, 0, -1);
/*$customer = new Customer($this->context->customer->id);*/
$new = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(`id_order`) FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1 AND o.`id_customer` = '.(int) ($this->context->customer? $this->context->customer->id: 0));
$this->context->smarty->assign(array(
'wic_criteo_account' => Configuration::get('WIC_CRITEO_ID_ACCOUNT'),
'wic_criteo_site_type' => Configuration::get('WIC_CRITEO_SITE_TYPE'),
'wic_product_list' => rtrim($strproducts, ','),
'wic_action' => 'orderConfirmation',
'wic_id_order' => (int) $cart->id,
'id_customer' => $this->context->customer? $this->context->customer->id: 0,
'old_customer' => (($new > 1) ? '1' : '0'),
'customer_email' => ($this->context->customer) ? md5($this->context->customer->email) : '',
'is_newsletter' => isset($_COOKIE['emst']) || (bool) Tools::getValue('emst'),
));
return $this->fetchTemplate('/views/templates/hooks/', 'criteo');
}
public function hookHeader($params)
{
global $site_version, $page_name;
if($page_name != 'order' && $page_name != 'order-confirmation' && $page_name != 'submit') {
return;
}
if(!isset($site_version) || $site_version != 'fr') {
return;
}
if (!Configuration::get('WIC_CRITEO_ID_ACCOUNT') || !Configuration::get('WIC_CRITEO_SITE_TYPE'))
return false;
return '<script type="text/javascript" src="//static.criteo.com/js/ld/ld.js" async="true"></script>';
}
public function hookHome($params)
{
global $site_version;
if(!isset($site_version) || $site_version != 'fr') {
return;
}
if (!Configuration::get('WIC_CRITEO_ID_ACCOUNT') || !Configuration::get('WIC_CRITEO_SITE_TYPE'))
return false;
if ($this->context->customer && $this->context->customer->id) {
$email = $this->context->customer->email;
} else {
$email = '';
}
$this->context->smarty->assign(array(
'wic_criteo_account' => Configuration::get('WIC_CRITEO_ID_ACCOUNT'),
'wic_criteo_site_type' => Configuration::get('WIC_CRITEO_SITE_TYPE'),
'wic_action' => 'home',
'id_customer' => $this->context->customer? $this->context->customer->id: 0,
'customer_email' => ($email) ? md5($email) : '',
'is_newsletter' => isset($_COOKIE['emst']) || (bool) Tools::getValue('emst'),
));
return $this->fetchTemplate('/views/templates/hooks/', 'criteo');
}
public function hookFooter($params)
{
global $site_version;
if(!isset($site_version) || $site_version != 'fr') {
return;
}
if (!Configuration::get('WIC_CRITEO_ID_ACCOUNT') || !Configuration::get('WIC_CRITEO_SITE_TYPE')) {
return false;
}
if (Tools::getValue('id_category')) {
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
WHERE cp.`id_category` = '.(int)Tools::getValue('id_category').'
AND p.`active` = 1 ORDER BY cp.`position`
LIMIT 3
');
if ($this->context->customer && $this->context->customer->id) {
$email = $this->context->customer->email;
} else {
$email = '';
}
$this->context->smarty->assign(array(
'wic_criteo_account' => Configuration::get('WIC_CRITEO_ID_ACCOUNT'),
'wic_criteo_site_type' => Configuration::get('WIC_CRITEO_SITE_TYPE'),
'wic_action' => _PS_OPEN_SHOP_? 'productList': 'productFooter',
'id_customer' => $this->context->customer? $this->context->customer->id: 0,
'customer_email' => ($email) ? md5($email) : '',
'is_newsletter' => isset($_COOKIE['emst']) || (bool) Tools::getValue('emst'),
));
if (isset($products)) {
$products_data = array();
foreach ($products as $product) {
$products_data[] = (int)$product['id_product'];
}
$this->context->smarty->assign(array('products_data' => implode(',', $products_data)));
}
return $this->fetchTemplate('/views/templates/hooks/', 'criteo');
} elseif (Tools::getValue('search_query')) {
if ($this->context->customer && $this->context->customer->id)
{
$email = $this->context->customer->email;
} else {
$email = '';
}
$this->context->smarty->assign(array(
'wic_criteo_account' => Configuration::get('WIC_CRITEO_ID_ACCOUNT'),
'wic_criteo_site_type' => Configuration::get('WIC_CRITEO_SITE_TYPE'),
'wic_action' => 'search',
'id_customer' => $this->context->customer? $this->context->customer->id: 0,
'customer_email' => ($email) ? md5($email) : '',
'searchQuery' => Tools::getValue('search_query'),
'is_newsletter' => isset($_COOKIE['emst']) || (bool) Tools::getValue('emst'),
));
return $this->fetchTemplate('/views/templates/hooks/', 'criteo');
} else {
return false;
}
}
}

View File

@ -0,0 +1,112 @@
<?php
/*$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_PORT'] = 80;*/
include_once(dirname(__FILE__).'/../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/criteo_bbb.php');
ini_set('memory_limit', '2G');
class XML extends SimpleXMLElement {
public function addChildAuto($name, $value=NULL) {
if(is_string($value)) {
return $this->addChildCDATA($name, $value);
} else {
return $this->addChild($name, $value);
}
}
public function addChildCDATA($name, $value=NULL) {
$new_child = $this->addChild($name);
if ($new_child !== NULL) {
$node = dom_import_simplexml($new_child);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($value));
}
return $new_child;
}
}
setlocale('LC_TIME', 'fr_FR.utf8');
$id_lang = 2;
// --> flux catalogue products
$xml = new XML('<?xml version="1.0" encoding="UTF-8"?><products />');
foreach(Db::getInstance()->ExecuteS('
SELECT DISTINCT p.`id_product`, p.`price`, p.`quantity`, pl.`name`, pl.`link_rewrite`, (sp.`reduction`) as `discount`, psl.`description`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` psc ON p.`id_product` = psc.`id_product`
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = p.`id_product`
LEFT JOIN `'._DB_PREFIX_.'specific_price` sp ON p.`id_product` = sp.`id_product`
LEFT JOIN `'._DB_PREFIX_.'privatesale` ps ON psc.`id_sale` = ps.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_site_version` psv ON psv.`id_sale` = ps.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_lang` psl ON psl.`id_sale` = ps.`id_sale`
WHERE ps.`date_start` < NOW()
AND ps.`date_end` > NOW()
AND ps.`enabled` = 1
AND psv.`version` = "fr"
AND pl.`id_lang` = '.(int) $id_lang.'
AND psl.`id_lang` = '.(int) $id_lang.'
AND ps.`id_sale` IS NOT NULL
ORDER BY ps.`id_sale`
') as $row) {
if (Pack::isPack((int)$row['id_product'])) {
continue;
}
$product = new Product((int)$row['id_product'], true);
$s = $xml->addChildAuto('product');
$s->addAttribute("id",$row['id_product']);
$s->addChildAuto('name', htmlentities($row['name']));
$s->addChildAuto('producturl', 'http://www.bebeboutik.com/?utm_source=retargeting&utm_medium=cpc&utm_campaign=criteo&lp=criteo');
/* Image Cover */
$cover = Product::getCover((int)$row['id_product']);
$link = new Link();
$smallimage = $link->getImageLink($row['link_rewrite'], (int)$cover['id_image'], 'small');
$bigimage = $link->getImageLink($row['link_rewrite'], (int)$cover['id_image'], 'thickbox');
$s->addChildAuto('smallimage', $smallimage);
$s->addChildAuto('bigimage', $bigimage);
$s->addChildAuto('description', htmlentities($row['description']));
$price = $product->getPrice(true, (int)Product::getDefaultAttribute($product->id));
if ($product->getPrice(true, (int)Product::getDefaultAttribute((int)$product->id), 6, null, false, false)) {
$val = $product->getPrice(true, (int)Product::getDefaultAttribute((int)$product->id), 6, null, false, false);
} else {
$val = 1;
}
$price = number_format($price, 2, '.', '');
$retailprice = number_format($product->getPrice(true, (int)Product::getDefaultAttribute((int)$product->id), 6, null, false, false), 2, '.', '');
$discount = number_format($product->getPrice(true, null, 2, null, true) * 100 / $val, 2, '.', '');
$s->addChildAuto('price', $price);
if ($retailprice>$price) {
$s->addChildAuto('retailprice', $retailprice);
}
if ($discount>0) {
$s->addChildAuto('discount', $discount);
}
$instock = 0;
if((int)$row['quantity']>0) {
$instock = 1;
}
$s->addChildAuto('instock', $instock);
$categories = Product::getProductCategoriesFull((int)$product->id, $id_lang);
if ($categories) {
$i = 1;
foreach ($categories as $category) {
$s->addChildAuto('category_'.$i, htmlentities($category['name']));
$i++;
}
}
}
/*file_put_contents(dirname(__FILE__).'/www/criteo_sales.fr.xml', $xml->asXML());*/
file_put_contents(dirname(__FILE__).'/criteo_sales.fr.xml', $xml->asXML());

View File

@ -0,0 +1,87 @@
.readme {
float: right;
margin-right: 20px;
margin-top: -60px;
}
.readme a {color:#ce1919;}
.readme a:hover {text-decoration:underline;}
.technical_support{line-height: 15px;display: inline-block;margin-left: 15px;}
.technical_support i{color:#96c11f;}
.technical_support a{color:#1073ba;}
#criteo-wrapper center.submit {
background: none repeat scroll 0 0 #DFDFDF;
border: 5px solid #EFEFEF;
padding: 10px;
}
div#content.nobootstrap .toolbar-placeholder {
background-color: #F8F8F8;
border: 1px solid #CCCCCC;
margin-bottom: 10px;
padding: 10px 0;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
position:relative;
}
div#content.nobootstrap .toolbar-placeholder .pageTitle h3 {
font-size: 2em;
line-height: 48px;
text-shadow: 0 1px 0 #fff;
}
div#content.nobootstrap .toolbar-placeholder .pageTitle h3 img {
float:left;
margin-top:-10px;
margin-right:10px;
}
.tab-row .tab {
float:none!important;
}
.tab-page {z-index:0;}
.toolbarBox {z-index:10!important;}
iframe {
margin-top: 20px;
margin-bottom: 30px;
padding:10px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 2px 2px 8px #000;
-webkit-box-shadow: 2px 2px 8px #000;
box-shadow: 2px 2px 8px #000;
border:1px;
margin: 20px auto;
display:block;
}
.nobootstrap {
width: 78%!important;
min-width: 78%;
}
.alert.alert-warning{
padding-left: 50px;
position: relative;
border: none;
border-left: solid 3px #f4c178;
}
.alert-warning {
background-color: #fcf8e3;
border-color: #faebcc;
color: #8a6d3b;
}
.alert {
padding: 15px;
margin-bottom: 17px;
}

View File

@ -0,0 +1,34 @@
.readme {
float: right;
margin-right: 20px;
margin-top: -60px;
}
.readme a {color:#ce1919;}
.readme a:hover {text-decoration:underline;}
.technical_support{line-height: 15px;display: inline-block;margin-left: 15px;}
.technical_support i{color:#96c11f;}
.technical_support a{color:#1073ba;}
.toolbarBox {
background-color: #F8F8F8;
border: 1px solid #CCCCCC;
margin-bottom: 10px;
padding: 10px 0;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
div.fix-toolbar {
border-bottom: 1px solid #E0E0E0;
position: fixed;
top: 0;
opacity: 0.9;
z-index: 1;
}
#criteo-wrapper center.submit {
background: none repeat scroll 0 0 #DFDFDF;
border: 5px solid #EFEFEF;
padding: 10px;
}

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

15
modules/criteo_bbb/de.php Normal file
View File

@ -0,0 +1,15 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{criteo}prestashop>criteo_0c90fc1c188056486dbb210f25023b8a'] = 'Criteo';
$_MODULE['<{criteo}prestashop>criteo_dfa5d522cd54e1ef0f94ec2ed4a61419'] = 'Criteo Produkt Export-und Tag-Anzeige';
$_MODULE['<{criteo}prestashop>criteo_7ccf58c950043c9fbfed668df13ce608'] = 'Die Einstellungen werden aktualisiert';
$_MODULE['<{criteo}prestashop>criteo_2667504f82250eacbd377f121b5c57e0'] = 'Criteo Export';
$_MODULE['<{criteo}prestashop>criteo_96814c8ba0e8753f60d3ded7799ac5f8'] = 'Criteo normale Kennung';
$_MODULE['<{criteo}prestashop>criteo_e60d35bcd2d65206757417532f509366'] = 'Criteo Konversionskennung';
$_MODULE['<{criteo}prestashop>criteo_2a0b3f9396d21be5b3eb7e3bed1ed495'] = 'URL Widget';
$_MODULE['<{criteo}prestashop>criteo_a4d3b161ce1309df1c4e25df28694b7b'] = 'Senden';
$_MODULE['<{criteo}prestashop>criteo_c452f9f8ae244baf28588108f83e0a8a'] = 'Ihre URL, für die Kommunikation mit Criteo:';
?>

View File

@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7061 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(dirname(__FILE__).'/../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/criteo_bbb.php');
if (Tools::getValue('token') != sha1(_COOKIE_KEY_.'exportCriteo'))
die(Tools::displayError('The token is invalid, please check the export url in your module configuration.'));
Criteo_bbb::buildCSV();
?>

View File

@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7061 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(dirname(__FILE__).'/../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/criteo_bbb.php');
if (Tools::getValue('token') != sha1(_COOKIE_KEY_.'exportCriteo'))
die(Tools::displayError('The token is invalid, please check the export url in your module configuration.'));
Criteo_bbb::buildXML();
?>

View File

@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

15
modules/criteo_bbb/it.php Normal file
View File

@ -0,0 +1,15 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{criteo}prestashop>criteo_0c90fc1c188056486dbb210f25023b8a'] = 'Criteo';
$_MODULE['<{criteo}prestashop>criteo_dfa5d522cd54e1ef0f94ec2ed4a61419'] = 'Esportazione di prodotti Criteo e visualizzazione tag';
$_MODULE['<{criteo}prestashop>criteo_7ccf58c950043c9fbfed668df13ce608'] = 'Impostazioni aggiornate';
$_MODULE['<{criteo}prestashop>criteo_2667504f82250eacbd377f121b5c57e0'] = 'Export Criteo ';
$_MODULE['<{criteo}prestashop>criteo_96814c8ba0e8753f60d3ded7799ac5f8'] = 'Identificante Criteo normale';
$_MODULE['<{criteo}prestashop>criteo_e60d35bcd2d65206757417532f509366'] = 'Identificante Criteo conversione ';
$_MODULE['<{criteo}prestashop>criteo_2a0b3f9396d21be5b3eb7e3bed1ed495'] = 'URL Widget';
$_MODULE['<{criteo}prestashop>criteo_a4d3b161ce1309df1c4e25df28694b7b'] = 'Invia';
$_MODULE['<{criteo}prestashop>criteo_c452f9f8ae244baf28588108f83e0a8a'] = 'URL da comunicare a Criteo:';
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

View File

@ -0,0 +1,80 @@
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
$(document).ready(function(){
var message = $('.toolbarHead');
var view = $(window);
// bind only if message exists. placeholder will be its parent
view.bind("scroll resize", function(e)
{
message.each(function(el){
if (message.length)
{
placeholder = $(this).parent();
if(e.type == 'resize')
$(this).css('width', $(this).parent().width());
placeholderTop = placeholder.offset().top;
var viewTop = view.scrollTop() + 15;
// here we force the toolbar to be "not fixed" when
// the height of the window is really small (toolbar hiding the page is not cool)
window_is_more_than_twice_the_toolbar = view.height() > message.parent().height() * 2;
if (!$(this).hasClass("fix-toolbar") && (window_is_more_than_twice_the_toolbar && (viewTop > placeholderTop)))
{
$(this).css('width', $(this).width());
// fixing parent height will prevent that annoying "pagequake" thing
// the order is important : this has to be set before adding class fix-toolbar
$(this).parent().css('height', $(this).parent().height());
$(this).addClass("fix-toolbar");
}
else if ($(this).hasClass("fix-toolbar") && (!window_is_more_than_twice_the_toolbar || (viewTop <= placeholderTop)) )
{
$(this).removeClass("fix-toolbar");
$(this).removeAttr('style');
$(this).parent().removeAttr('style');
}
}
});
}); // end bind
// if count errors
$('#hideError').live('click', function(e)
{
e.preventDefault();
$('.error').hide('slow', function (){
$('.error').remove();
});
return false;
});
// if count warnings
$('#linkSeeMore').live('click', function(e){
e.preventDefault();
$('.warn #seeMore').show();
$(this).hide();
$('.warn #linkHide').show();
return false;
});
$('#linkHide').live('click', function(e){
e.preventDefault();
$('.warn #seeMore').hide();
$(this).hide();
$('.warn #linkSeeMore').show();
return false;
});
$('#hideWarn').live('click', function(e){
e.preventDefault();
$('.warn').hide('slow', function (){
$('.warn').remove();
});
return false;
});
});

BIN
modules/criteo_bbb/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

BIN
modules/criteo_bbb/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1,22 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
include_once(dirname(__FILE__).'/../../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../../init.php');
include_once(dirname(__FILE__).'/../criteo_bbb.php');
$criteo = new Criteo_bbb();
if (Tools::getValue('token') != sha1(_COOKIE_KEY_.'exportCriteo'))
die(Tools::displayError('The token is invalid, please check the export url in your module configuration.'));
$criteo->buildCSV();
?>

View File

@ -0,0 +1,23 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
include_once(dirname(__FILE__).'/../../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../../init.php');
include_once(dirname(__FILE__).'/../criteo_bbb.php');
if (Tools::getValue('token') != sha1(_COOKIE_KEY_.'exportCriteo'))
die(Tools::displayError('The token is invalid, please check the export url in your module configuration.'));
header('Content-type: text/xml');
$file = file_get_contents(dirname(__FILE__).'/../criteo_sales.fr.xml');
echo $file;
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

View File

@ -0,0 +1,19 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{criteo}prestashop>criteo_0c90fc1c188056486dbb210f25023b8a'] = 'Criteo';
$_MODULE['<{criteo}prestashop>criteo_dfa5d522cd54e1ef0f94ec2ed4a61419'] = 'Etiquetas de integración Criteo catálogo de exportación ';
$_MODULE['<{criteo}prestashop>criteo_af5314ecb1403feaf3ab13ed3512469a'] = 'Todos los campos son obligatorios ';
$_MODULE['<{criteo}prestashop>criteo_462390017ab0938911d2d4e964c0cab7'] = 'Los datos hicieron que nuestro éxito ';
$_MODULE['<{criteo}prestashop>criteo_ba0f1c34f839f38d571c357a57cd7b09'] = 'La experiencia Prestashop e-commerce ';
$_MODULE['<{criteo}prestashop>criteo_7f180095f2e237f88930494bb955597b'] = 'criteo_en.pdf';
$_MODULE['<{criteo}prestashop>criteo_78913420d3ede25b0463d047daa5913d'] = 'Descargar la documentación';
$_MODULE['<{criteo}prestashop>criteo_2667504f82250eacbd377f121b5c57e0'] = 'Exportación Criteo ';
$_MODULE['<{criteo}prestashop>criteo_c452f9f8ae244baf28588108f83e0a8a'] = 'URL para comunicar a Criteo';
$_MODULE['<{criteo}prestashop>criteo_e812c9ec2c4d99227d353cbf1778d2c3'] = 'Id Criteo ';
$_MODULE['<{criteo}prestashop>criteo_0b8ae75ff4e6c5dc59aeb17990365d9a'] = 'Tipo de sitio';
$_MODULE['<{criteo}prestashop>criteo_369e99ab0d524e8467b14339a8838997'] = 'sitio clásico';
$_MODULE['<{criteo}prestashop>criteo_3e9f2053778a2917c16cb9226d4b273b'] = 'sitio móvil ';
$_MODULE['<{criteo}prestashop>criteo_23ae197f6047b151c71172732ee59581'] = 'tableta del sitio';
$_MODULE['<{criteo}prestashop>criteo_a4d3b161ce1309df1c4e25df28694b7b'] = 'Guardar';

View File

@ -0,0 +1,27 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{criteo}prestashop>criteo_0c90fc1c188056486dbb210f25023b8a'] = 'Criteo';
$_MODULE['<{criteo}prestashop>criteo_dfa5d522cd54e1ef0f94ec2ed4a61419'] = 'Export produits Criteo et affichage des tags Criteo.';
$_MODULE['<{criteo}prestashop>criteo_af5314ecb1403feaf3ab13ed3512469a'] = 'Tous les champs sont obligatoires.';
$_MODULE['<{criteo}prestashop>criteo_462390017ab0938911d2d4e964c0cab7'] = 'Configuration sauvegardée';
$_MODULE['<{criteo}prestashop>criteo_ba0f1c34f839f38d571c357a57cd7b09'] = 'L\'expertise e-commerce Prestashop';
$_MODULE['<{criteo}prestashop>criteo_7f180095f2e237f88930494bb955597b'] = 'criteo_fr.pdf';
$_MODULE['<{criteo}prestashop>criteo_78913420d3ede25b0463d047daa5913d'] = 'Télécharger la documentation';
$_MODULE['<{criteo}prestashop>criteo_2667504f82250eacbd377f121b5c57e0'] = 'Export Criteo';
$_MODULE['<{criteo}prestashop>criteo_c452f9f8ae244baf28588108f83e0a8a'] = 'URL à communiquer à Criteo';
$_MODULE['<{criteo}prestashop>criteo_e812c9ec2c4d99227d353cbf1778d2c3'] = 'Identifiant Criteo';
$_MODULE['<{criteo}prestashop>criteo_0b8ae75ff4e6c5dc59aeb17990365d9a'] = 'Type de site';
$_MODULE['<{criteo}prestashop>criteo_369e99ab0d524e8467b14339a8838997'] = 'Site classique';
$_MODULE['<{criteo}prestashop>criteo_3e9f2053778a2917c16cb9226d4b273b'] = 'Site mobile';
$_MODULE['<{criteo}prestashop>criteo_23ae197f6047b151c71172732ee59581'] = 'Site tablette';
$_MODULE['<{criteo}prestashop>criteo_c8aa75a4327f59f70829e3cabfb5c3b1'] = 'Afficher les catégories dans le flux XML';
$_MODULE['<{criteo}prestashop>criteo_9b5539c34ec19fa77e2b13a7116fc53d'] = 'Vous pouvez exclure des catégories, les produits appartenant à ces catégories ne seront pas présents dans e flux XML';
$_MODULE['<{criteo}prestashop>criteo_6080d9c0474bc71acd3f254be9cae0f5'] = 'Attention ! ';
$_MODULE['<{criteo}prestashop>criteo_dee58b862c8be7ccd68cc3eae7996725'] = 'Les produits dont la catégorie par défaut est sélectionnée ne seront pas exportés.';
$_MODULE['<{criteo}prestashop>criteo_65c32e72fe2972bbeb1c91f26b874504'] = 'Filtre catégories';
$_MODULE['<{criteo}prestashop>criteo_b718adec73e04ce3ec720dd11a06a308'] = 'ID';
$_MODULE['<{criteo}prestashop>criteo_49ee3087348e8d44e1feda1917443987'] = 'Nom';
$_MODULE['<{criteo}prestashop>criteo_b4fc530e0696622a1d1d3480a4af59b4'] = 'Cocher les cases des catégories pour lesquelles vous ne souhaitez pas que les produits soient présents dans le flux XML.';
$_MODULE['<{criteo}prestashop>criteo_a4d3b161ce1309df1c4e25df28694b7b'] = 'Sauvegarder';

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

View File

@ -0,0 +1,39 @@
{*
* @author Web In Color - addons@webincolor.fr
* @version 2.5
* @uses Prestashop modules
* @since 1.0 - 22 juillet 2013
* @package criteo
* @copyright Copyright &copy; 2013, Web In Color
*}
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{literal}{ event: "setAccount", account:{/literal}{$wic_criteo_account|intval}{literal}},{/literal}
{if $id_customer}
{literal}{ event: "setCustomerId", id: {/literal}"{$id_customer|intval}"{literal}},{/literal}
{/if}
{if $customer_email}
{literal}{ event: "setHashedEmail", email:["{/literal}{$customer_email|escape:'htmlall':'UTF-8'}{literal}"]},{/literal}
{/if}
{literal}{ event: "setSiteType", type: {/literal}"{$wic_criteo_site_type|escape:'html'}"{literal}},{/literal}
{if $wic_action == 'productFooter'}
{literal}{ event: "viewItem", user_segment: "{/literal}{if $is_newsletter}2{else}1{/if}{literal}", product: {/literal}"{$wic_product_id|escape:'html'}" {literal}}{/literal}
{elseif $wic_action == 'productList'}
{literal}{ event: "viewList", user_segment: "{/literal}{if $is_newsletter}2{else}1{/if}{literal}", product: [{/literal}{$products_data|escape:'html'}{literal}]}{/literal}
{elseif $wic_action == 'shoppingCart'}
{literal}{ event: "viewBasket", user_segment: "{/literal}{if $is_newsletter}2{else}1{/if}{literal}", product: [{/literal}{$wic_product_list|escape:'none'}{literal}]}{/literal}
{elseif $wic_action == 'search'}
{if isset($search_products)}
{literal}{ event: "viewList", user_segment: "{/literal}{if $is_newsletter}2{else}1{/if}{literal}", product: [{/literal}{foreach from=$search_products item=product name=search_products}{if $smarty.foreach.search_products.index < 3}{$product.id_product|intval}{if !$smarty.foreach.search_products.last && $smarty.foreach.search_products.index < 2},{/if}{/if}{/foreach}], keywords: "{$searchQuery|escape:'html'}"{literal}}{/literal}
{/if}
{elseif $wic_action == 'orderConfirmation'}
{literal}{ event: "trackTransaction", user_segment: "{/literal}{if $is_newsletter}2{else}1{/if}{literal}", id: "{/literal}{$wic_id_order|intval}{literal}", new_customer: {/literal}{if $old_customer}0{else}1{/if}{literal},
product: [{/literal}
{$wic_product_list|escape:'none'}{literal}
]}{/literal}
{elseif $wic_action == 'home'}
{literal}{ event: "viewHome", user_segment: "{/literal}{if $is_newsletter}2{else}1{/if}{literal}"}{/literal}
{/if}
);
</script>

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;

View File

@ -0,0 +1,20 @@
<?php
/**
* Module Criteo Tag et Flux Web In Color
*
* @author Web In Color - addons@webincolor.fr
* @uses Prestashop modules
* @package criteo
* @copyright Copyright &copy; 2014, Web In Color
* @license http://www.webincolor.fr
*/
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;