Skip to content

Commit 1c2994c

Browse files
committed
Update hookdisplayOrderConfirmation for 1.6
1 parent 22cd202 commit 1c2994c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

ps_googleanalytics.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Ps_Googleanalytics extends Module
4040
protected $filterable = 1;
4141
protected static $products = array();
4242
protected $_debug = 0;
43+
protected $psVersionIs17;
4344

4445
public function __construct()
4546
{
@@ -55,8 +56,8 @@ public function __construct()
5556

5657
$this->displayName = $this->l('Google Analytics', array(), 'Modules.GAnalytics.Admin');
5758
$this->description = $this->l('Gain clear insights into important metrics about your customers, using Google Analytics', array(), 'Modules.GAnalytics.Admin');
58-
5959
$this->confirmUninstall = $this->l('Are you sure you want to uninstall Google Analytics? You will lose all the data related to this module.', array(), 'Modules.GAnalytics.Admin');
60+
$this->psVersionIs17 = (bool) version_compare(_PS_VERSION_, '1.7', '>=');
6061
}
6162
public function install()
6263
{
@@ -389,7 +390,12 @@ public function wrapOrder($id_order)
389390
*/
390391
public function hookdisplayOrderConfirmation($params)
391392
{
392-
$order = $params['order'];
393+
if (true === $this->psVersionIs17) {
394+
$order = $params['order'];
395+
} else {
396+
$order = $params['objOrder'];
397+
}
398+
393399
if (Validate::isLoadedObject($order) && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR')) {
394400
$ga_order_sent = Db::getInstance()->getValue('SELECT id_order FROM `'._DB_PREFIX_.'ganalytics` WHERE id_order = '.(int)$order->id);
395401
if ($ga_order_sent === false) {

0 commit comments

Comments
 (0)