Merge branch 'ticket-criteo' into develop

This commit is contained in:
Marion Muszynski 2016-07-27 17:43:09 +02:00
commit 2210cf508e
2 changed files with 14 additions and 5 deletions

View File

@ -55,6 +55,7 @@ class Criteo_bbb extends Module
Configuration::updateValue('WIC_CRITEO_SITE_TYPE', pSQL(Tools::getValue('site_type_criteo'))); 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_CATEGORY', (Tools::getValue('category') ? implode(',', Tools::getValue('category')) : ''));
Configuration::updateValue('WIC_CRITEO_DISPLAY_CAT', Tools::getValue('display_category_criteo')); Configuration::updateValue('WIC_CRITEO_DISPLAY_CAT', Tools::getValue('display_category_criteo'));
Configuration::updateValue('WIC_CRITEO_URL_MODE', pSQL(Tools::getValue('url_criteo_mode')));
return $this->displayConfirmation($this->l('Settings updated successfully')); return $this->displayConfirmation($this->l('Settings updated successfully'));
} }
@ -108,6 +109,10 @@ class Criteo_bbb extends Module
<label for="display_category_criteo">'.$this->l('Display Category produt in XML flow').' :</label> <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="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 <input type="radio" value="1" name="display_category_criteo" '.(Configuration::get('WIC_CRITEO_DISPLAY_CAT') ? 'checked=checked' : '').' />&nbsp;&nbsp;Yes
<br/><br/>
<label for="display_category_criteo">'.$this->l('Use url produt in XML flow').' :</label>
<input type="radio" value="0" name="url_criteo_mode" '.(Configuration::get('WIC_CRITEO_URL_MODE') ? '' : 'checked=checked').' />&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" value="1" name="url_criteo_mode" '.(Configuration::get('WIC_CRITEO_URL_MODE') ? 'checked=checked' : '').' />&nbsp;&nbsp;Yes
<br/><br/>'; <br/><br/>';
@ -558,7 +563,7 @@ class Criteo_bbb extends Module
FROM `'._DB_PREFIX_.'product` p FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product` LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
WHERE cp.`id_category` = '.(int)Tools::getValue('id_category').' WHERE cp.`id_category` = '.(int)Tools::getValue('id_category').'
AND p.`active` = 1 ORDER BY cp.`position` AND p.`active` = 1 ORDER BY cp.`position`
LIMIT 3 LIMIT 3
'); ');

View File

@ -1,7 +1,7 @@
<?php <?php
/*$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com'; $_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_PORT'] = 80;*/ $_SERVER['SERVER_PORT'] = 80;
include_once(dirname(__FILE__).'/../../config/config.inc.php'); include_once(dirname(__FILE__).'/../../config/config.inc.php');
include_once(dirname(__FILE__).'/../../init.php'); include_once(dirname(__FILE__).'/../../init.php');
@ -56,17 +56,21 @@ foreach(Db::getInstance()->ExecuteS('
if (Pack::isPack((int)$row['id_product'])) { if (Pack::isPack((int)$row['id_product'])) {
continue; continue;
} }
$link = new Link();
$product = new Product((int)$row['id_product'], true); $product = new Product((int)$row['id_product'], true);
$s = $xml->addChildAuto('product'); $s = $xml->addChildAuto('product');
$s->addAttribute("id",$row['id_product']); $s->addAttribute("id",$row['id_product']);
$s->addChildAuto('name', htmlentities($row['name'])); $s->addChildAuto('name', htmlentities($row['name']));
$s->addChildAuto('producturl', 'http://www.bebeboutik.com/?utm_source=retargeting&utm_medium=cpc&utm_campaign=criteo&lp=criteo'); if (!Configuration::get('WIC_CRITEO_URL_MODE')) {
$s->addChildAuto('producturl', 'http://www.bebeboutik.com/');
} else {
$s->addChildAuto('producturl', $link->getProductLink((int)$product->id, $product->link_rewrite[$id_lang], $product->ean13).);
}
/* Image Cover */ /* Image Cover */
$cover = Product::getCover((int)$row['id_product']); $cover = Product::getCover((int)$row['id_product']);
$link = new Link();
$smallimage = $link->getImageLink($row['link_rewrite'], (int)$cover['id_image'], 'small'); $smallimage = $link->getImageLink($row['link_rewrite'], (int)$cover['id_image'], 'small');
$bigimage = $link->getImageLink($row['link_rewrite'], (int)$cover['id_image'], 'thickbox'); $bigimage = $link->getImageLink($row['link_rewrite'], (int)$cover['id_image'], 'thickbox');
$s->addChildAuto('smallimage', $smallimage); $s->addChildAuto('smallimage', $smallimage);