Skip to content

Commit 7bb2738

Browse files
PSR-2
1 parent 87804ff commit 7bb2738

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

controllers/admin/AdminGanalyticsAjax.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public function init()
3333
$order = new Order((int)Tools::getValue('orderid'));
3434
$context = Context::getContext();
3535
if (Validate::isLoadedObject($order) && (isset($context->employee->id) && $context->employee->id)) {
36-
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'ganalytics` SET sent = 1, date_add = NOW() WHERE id_order = '.(int)Tools::getValue('orderid'));
36+
Db::getInstance()->execute('
37+
UPDATE `'._DB_PREFIX_.'ganalytics` SET sent = 1, date_add = NOW() WHERE id_order = '.(int)Tools::getValue('orderid')
38+
);
3739
die('OK');
3840
}
3941
die('KO');

controllers/front/ajax.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* International Registered Trademark & Property of PrestaShop SA
2525
*/
2626

27-
class ps_googleanalyticsAjaxModuleFrontController extends ModuleFrontController
27+
class ps_GoogleanalyticsAjaxModuleFrontController extends ModuleFrontController
2828
{
2929
public $ssl = true;
3030
/*
@@ -38,7 +38,9 @@ public function initContent()
3838
if (!Validate::isLoadedObject($order) || $order->id_customer != (int)Tools::getValue('customer')) {
3939
die;
4040
}
41-
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'ganalytics` SET sent = 1, date_add = NOW() WHERE id_order = '.(int)Tools::getValue('orderid').' LIMIT 1');
41+
Db::getInstance()->execute(
42+
'UPDATE `'._DB_PREFIX_.'ganalytics` SET sent = 1, date_add = NOW() WHERE id_order = '.(int)Tools::getValue('orderid').' LIMIT 1'
43+
);
4244
die;
4345
}
4446
}

ps_googleanalytics.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,13 @@ public function hookdisplayHome()
382382
// Home featured products
383383
if ($this->isModuleEnabled('ps_featuredproducts')) {
384384
$category = new Category($this->context->shop->getCategory(), $this->context->language->id);
385-
$home_featured_products = $this->wrapProducts($category->getProducts((int)Context::getContext()->language->id, 1,
386-
(Configuration::get('HOME_FEATURED_NBR') ? (int)Configuration::get('HOME_FEATURED_NBR') : 8), 'position'), array(), true);
385+
$home_featured_products = $this->wrapProducts(
386+
$category->getProducts((int)Context::getContext()->language->id,
387+
1,
388+
(Configuration::get('HOME_FEATURED_NBR') ? (int)Configuration::get('HOME_FEATURED_NBR') : 8), 'position'),
389+
array(),
390+
true
391+
);
387392
$ga_scripts .= $this->addProductImpression($home_featured_products).$this->addProductClick($home_featured_products);
388393
}
389394

@@ -583,8 +588,8 @@ public function addProductFromCheckout($products)
583588
public function hookdisplayFooterProduct($params)
584589
{
585590
$controller_name = Tools::getValue('controller');
586-
587-
if ($controller_name == 'product') {
591+
if ($controller_name == 'product')
592+
{
588593

589594
// Add product view
590595
$ga_product = $this->wrapProduct((array)$params['product'], null, 0, true);
@@ -696,10 +701,10 @@ public function hookactionProductCancel($params)
696701
// Display GA refund product
697702
$order_detail = new OrderDetail($orderdetail_id);
698703
$ga_scripts .= 'MBG.add('.Tools::jsonEncode(
699-
array(
700-
'id' => empty($order_detail->product_attribute_id)?$order_detail->product_id:$order_detail->product_id.'-'.$order_detail->product_attribute_id,
701-
'quantity' => $qty)
702-
).');';
704+
array(
705+
'id' => empty($order_detail->product_attribute_id)?$order_detail->product_id:$order_detail->product_id.'-'.$order_detail->product_attribute_id,
706+
'quantity' => $qty)
707+
).');';
703708
}
704709
$this->context->cookie->ga_admin_refund = $ga_scripts.'MBG.refundByProduct('.Tools::jsonEncode(array('id' => $params['order']->id)).');';
705710
}

0 commit comments

Comments
 (0)