Skip to content

Commit 385af15

Browse files
New Hook Name
1 parent 7e74cab commit 385af15

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

ps_googleanalytics.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function __construct()
4848

4949
$this->displayName = $this->l('Google Analytics');
5050
$this->description = $this->l('Gain clear insights into important metrics about your customers, using Google Analytics');
51+
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
5152
$this->confirmUninstall = $this->l('Are you sure you want to uninstall Google Analytics? You will lose all the data related to this module.');
5253

5354
}
@@ -57,11 +58,11 @@ public function install()
5758

5859
Shop::setContext(Shop::CONTEXT_ALL);
5960

60-
if (!parent::install() || !$this->installTab() || !$this->registerHook('header') || !$this->registerHook('adminOrder')
61-
|| !$this->registerHook('footer') || !$this->registerHook('home')
62-
|| !$this->registerHook('productfooter') || !$this->registerHook('orderConfirmation')
61+
if (!parent::install() || !$this->installTab() || !$this->registerHook('displayHeader') || !$this->registerHook('displayAdminOrder')
62+
|| !$this->registerHook('displayFooter') || !$this->registerHook('displayHome')
63+
|| !$this->registerHook('displayFooterProduct') || !$this->registerHook('displayOrderConfirmation')
6364
|| !$this->registerHook('actionProductCancel') || !$this->registerHook('actionCartSave')
64-
|| !$this->registerHook('backOfficeHeader')) || !$this->registerHook('processCarrier'))
65+
|| !$this->registerHook('displayBackOfficeHeader')) || !$this->registerHook('actionCarrierProcess'))
6566
return false;
6667

6768
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'ganalytics`');
@@ -250,7 +251,7 @@ protected function _getGoogleAnalyticsTag($back_office = false)
250251
.'</script>';
251252
}
252253

253-
public function hookHeader()
254+
public function hookdisplayHeader($params)
254255
{
255256
if (Configuration::get('GA_ACCOUNT_ID'))
256257
{
@@ -281,7 +282,7 @@ public function wrapOrder($id_order)
281282
/**
282283
* To track transactions
283284
*/
284-
public function hookOrderConfirmation($params)
285+
public function hookdisplayOrderConfirmation($params)
285286
{
286287
$order = $params['objOrder'];
287288
if (Validate::isLoadedObject($order) && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR'))
@@ -319,7 +320,7 @@ public function hookOrderConfirmation($params)
319320
/**
320321
* hook footer to load JS script for standards actions such as product clicks
321322
*/
322-
public function hookFooter()
323+
public function hookdisplayFooter()
323324
{
324325
$ga_scripts = '';
325326
$this->js_state = 0;
@@ -357,7 +358,7 @@ public function hookFooter()
357358
}
358359

359360

360-
$confirmation_hook_id = (int)Hook::getIdByName('orderConfirmation');
361+
$confirmation_hook_id = (int)Hook::getIdByName('displayOrderConfirmation');
361362
if (isset(Hook::$executed_hooks[$confirmation_hook_id]))
362363
$this->eligible = 1;
363364

@@ -382,7 +383,7 @@ protected function filter($ga_scripts)
382383
/**
383384
* hook home to display generate the product list associated to home featured, news products and best sellers Modules
384385
*/
385-
public function hookHome()
386+
public function hookdisplayHome()
386387
{
387388
$ga_scripts = '';
388389

@@ -587,7 +588,7 @@ public function addProductFromCheckout($products)
587588
/**
588589
* hook product page footer to load JS for product details view
589590
*/
590-
public function hookProductFooter($params)
591+
public function hookdisplayFooterProduct($params)
591592
{
592593
$controller_name = Tools::getValue('controller');
593594
if ($controller_name == 'product')
@@ -635,7 +636,7 @@ protected function _runJs($js_code, $backoffice = 0)
635636
/**
636637
* Hook admin order to send transactions and refunds details
637638
*/
638-
public function hookAdminOrder()
639+
public function hookdisplayAdminOrder()
639640
{
640641
echo $this->_runJs($this->context->cookie->ga_admin_refund, 1);
641642
unset($this->context->cookie->ga_admin_refund);
@@ -644,7 +645,7 @@ public function hookAdminOrder()
644645
/**
645646
* admin office header to add google analytics js
646647
*/
647-
public function hookBackOfficeHeader()
648+
public function hookdisplayBackOfficeHeader()
648649
{
649650
$js = '';
650651
if (strcmp(Tools::getValue('configure'), $this->name) === 0)
@@ -698,7 +699,7 @@ public function hookBackOfficeHeader()
698699
/**
699700
* Hook admin office header to add google analytics js
700701
*/
701-
public function hookActionProductCancel($params)
702+
public function hookactionProductCancel($params)
702703
{
703704
$qty_refunded = Tools::getValue('cancelQuantity');
704705
$ga_scripts = '';
@@ -718,7 +719,7 @@ public function hookActionProductCancel($params)
718719
/**
719720
* hook save cart event to implement addtocart and remove from cart functionality
720721
*/
721-
public function hookActionCartSave()
722+
public function hookactionCartSave()
722723
{
723724
if (!isset($this->context->cart))
724725
return;
@@ -795,7 +796,7 @@ public function hookActionCartSave()
795796
}
796797
}
797798

798-
public function hookProcessCarrier($params){
799+
public function hookactionCarrierProcess($params){
799800
if(isset($params['cart']->id_carrier)){
800801
$carrier_name = Db::getInstance()->getValue('SELECT name FROM `'._DB_PREFIX_.'carrier` WHERE id_carrier = '.(int)$params['cart']->id_carrier);
801802
$this->context->cookie->ga_cart .= 'MBG.addCheckoutOption(2,\''.$carrier_name.'\');';

0 commit comments

Comments
 (0)