// Context - first commit
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7586 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+15
-20
@@ -115,10 +115,13 @@ class Criteo extends Module
|
||||
}
|
||||
}
|
||||
|
||||
public static function buildCSV()
|
||||
public static function buildCSV($context = null)
|
||||
{
|
||||
global $cookie, $country_infos;
|
||||
$cookie = new Cookie('ps');
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
global $country_infos;
|
||||
|
||||
$country_infos = array('id_group' => 0, 'id_tax' => 1);
|
||||
$html = '';
|
||||
/* First line, columns */
|
||||
@@ -140,11 +143,7 @@ class Criteo extends Module
|
||||
'PS_SHOP_NAME',
|
||||
'PS_CURRENCY_DEFAULT',
|
||||
'PS_CARRIER_DEFAULT'));
|
||||
/* Language */
|
||||
$language = new Language(intval($conf['PS_LANG_DEFAULT']));
|
||||
|
||||
/* Link instance for products links */
|
||||
$link = new Link();
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT p.`id_product`, i.`id_image`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
@@ -166,7 +165,7 @@ class Criteo extends Module
|
||||
$line[] = $product->manufacturer_name.' - '.$product->name[intval($conf['PS_LANG_DEFAULT'])];
|
||||
$line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-small.jpg';
|
||||
$line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-thickbox.jpg';
|
||||
$line[] = $link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo';
|
||||
$line[] = $context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo';
|
||||
$line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($product->description_short[intval($conf['PS_LANG_DEFAULT'])], ENT_COMPAT, 'UTF-8')));
|
||||
|
||||
$price = $product->getPrice(true, intval(Product::getDefaultAttribute($product->id)));
|
||||
@@ -185,11 +184,12 @@ class Criteo extends Module
|
||||
echo $html;
|
||||
}
|
||||
|
||||
public static function buildXML()
|
||||
public static function buildXML($context = null)
|
||||
{
|
||||
global $cookie, $country_infos;
|
||||
|
||||
$cookie = new Cookie('ps');
|
||||
global $country_infos;
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$country_infos = array('id_group' => 0, 'id_tax' => 1);
|
||||
$html = '<products>'."\n";
|
||||
/* First line, columns */
|
||||
@@ -207,11 +207,6 @@ class Criteo extends Module
|
||||
'PS_SHOP_NAME',
|
||||
'PS_CURRENCY_DEFAULT',
|
||||
'PS_CARRIER_DEFAULT'));
|
||||
/* Language */
|
||||
$language = new Language(intval($conf['PS_LANG_DEFAULT']));
|
||||
|
||||
/* Link instance for products links */
|
||||
$link = new Link();
|
||||
|
||||
/* Searching for products */
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
@@ -237,7 +232,7 @@ class Criteo extends Module
|
||||
|
||||
$line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-small.jpg';
|
||||
$line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-thickbox.jpg';
|
||||
$line[] = $link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo';
|
||||
$line[] = $context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo';
|
||||
$line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($product->description_short[intval($conf['PS_LANG_DEFAULT'])], ENT_COMPAT, 'UTF-8')));
|
||||
|
||||
$price = $product->getPrice(true, intval(Product::getDefaultAttribute($product->id)));
|
||||
@@ -322,8 +317,8 @@ class Criteo extends Module
|
||||
|
||||
public function hookOrderConfirmation($params)
|
||||
{
|
||||
global $cookie, $country_infos;
|
||||
$cookie = new Cookie('ps');
|
||||
global $country_infos;
|
||||
|
||||
$country_infos = array('id_group' => 0,
|
||||
'id_tax' => 1);
|
||||
$cart = new Cart(intval($params['objOrder']->id_cart));
|
||||
|
||||
Reference in New Issue
Block a user