@@ -49,28 +49,21 @@ public function __construct()
4949 $ this ->displayName = $ this ->l ('Google Analytics ' );
5050 $ this ->description = $ this ->l ('Gain clear insights into important metrics about your customers, using Google Analytics ' );
5151 $ this ->confirmUninstall = $ this ->l ('Are you sure you want to uninstall Google Analytics? You will lose all the data related to this module. ' );
52- /* Backward compatibility */
53- if (version_compare (_PS_VERSION_ , '1.5 ' , '< ' ))
54- require (_PS_MODULE_DIR_ .$ this ->name .'/backward_compatibility/backward.php ' );
5552
56- $ this ->checkForUpdates ();
5753 }
5854
5955 public function install ()
6056 {
61- if ( version_compare ( _PS_VERSION_ , ' 1.5 ' , ' >= ' ) && Shop:: isFeatureActive ())
62- Shop::setContext (Shop::CONTEXT_ALL );
57+
58+ Shop::setContext (Shop::CONTEXT_ALL );
6359
6460 if (!parent ::install () || !$ this ->installTab () || !$ this ->registerHook ('header ' ) || !$ this ->registerHook ('adminOrder ' )
6561 || !$ this ->registerHook ('footer ' ) || !$ this ->registerHook ('home ' )
6662 || !$ this ->registerHook ('productfooter ' ) || !$ this ->registerHook ('orderConfirmation ' )
63+ || !$ this ->registerHook ('actionProductCancel ' ) || !$ this ->registerHook ('actionCartSave ' )
6764 || !$ this ->registerHook ('backOfficeHeader ' )) || !$ this ->registerHook ('processCarrier ' ))
6865 return false ;
6966
70- if (version_compare (_PS_VERSION_ , '1.5 ' , '>= ' )
71- && (!$ this ->registerHook ('actionProductCancel ' ) || !$ this ->registerHook ('actionCartSave ' )))
72- return false ;
73-
7467 Db::getInstance ()->Execute ('DROP TABLE IF EXISTS ` ' ._DB_PREFIX_ .'ganalytics` ' );
7568
7669 if (!Db::getInstance ()->Execute ('
@@ -100,8 +93,6 @@ public function uninstall()
10093
10194 public function installTab ()
10295 {
103- if (version_compare (_PS_VERSION_ , '1.5 ' , '< ' ))
104- return true ;
10596
10697 $ tab = new Tab ();
10798 $ tab ->active = 0 ;
@@ -116,8 +107,6 @@ public function installTab()
116107
117108 public function uninstallTab ()
118109 {
119- if (version_compare (_PS_VERSION_ , '1.5 ' , '< ' ))
120- return true ;
121110
122111 $ id_tab = (int )Tab::getIdFromClassName ('AdminGanalyticsAjax ' );
123112 if ($ id_tab )
@@ -232,16 +221,8 @@ public function getContent()
232221 $ output .= $ this ->displayConfirmation ($ this ->l ('Settings for User ID updated successfully ' ));
233222 }
234223 }
235-
236- if (version_compare (_PS_VERSION_ , '1.5 ' , '>= ' ))
237- $ output .= $ this ->displayForm ();
238- else
239- {
240- $ this ->context ->smarty ->assign (array (
241- 'account_id ' => Configuration::get ('GA_ACCOUNT_ID ' ),
242- ));
243- $ output .= $ this ->display (__FILE__ , 'views/templates/admin/form-ps14.tpl ' );
244- }
224+
225+ $ output .= $ this ->displayForm ();
245226
246227 return $ this ->display (__FILE__ , 'views/templates/admin/configuration.tpl ' ).$ output ;
247228 }
@@ -320,7 +301,7 @@ public function hookOrderConfirmation($params)
320301
321302 $ transaction = array (
322303 'id ' => $ order ->id ,
323- 'affiliation ' => (version_compare ( _PS_VERSION_ , ' 1.5 ' , ' >= ' ) && Shop::isFeatureActive ()) ? $ this ->context ->shop ->name : Configuration::get ('PS_SHOP_NAME ' ),
304+ 'affiliation ' => (Shop::isFeatureActive ()) ? $ this ->context ->shop ->name : Configuration::get ('PS_SHOP_NAME ' ),
324305 'revenue ' => $ order ->total_paid ,
325306 'shipping ' => $ order ->total_shipping ,
326307 'tax ' => $ order ->total_paid_tax_incl - $ order ->total_paid_tax_excl ,
@@ -375,17 +356,10 @@ public function hookFooter()
375356 $ ga_scripts .= 'MBG.addCheckout( \'' .(int )$ step .'\'); ' ;
376357 }
377358
378- if (version_compare (_PS_VERSION_ , '1.5 ' , '< ' ))
379- {
380- if ($ controller_name == 'orderconfirmation ' )
381- $ this ->eligible = 1 ;
382- }
383- else
384- {
385- $ confirmation_hook_id = (int )Hook::getIdByName ('orderConfirmation ' );
386- if (isset (Hook::$ executed_hooks [$ confirmation_hook_id ]))
387- $ this ->eligible = 1 ;
388- }
359+
360+ $ confirmation_hook_id = (int )Hook::getIdByName ('orderConfirmation ' );
361+ if (isset (Hook::$ executed_hooks [$ confirmation_hook_id ]))
362+ $ this ->eligible = 1 ;
389363
390364 if (isset ($ products ) && count ($ products ) && $ controller_name != 'index ' )
391365 {
@@ -447,19 +421,8 @@ public function hookHome()
447421 */
448422 public function isModuleEnabled ($ name )
449423 {
450- if (version_compare (_PS_VERSION_ , '1.5 ' , '>= ' ))
451- if (Module::isEnabled ($ name ))
452- {
453- $ module = Module::getInstanceByName ($ name );
454- return $ module ->isRegisteredInHook ('home ' );
455- }
456- else
457- return false ;
458- else
459- {
460- $ module = Module::getInstanceByName ($ name );
461- return ($ module && $ module ->active === true );
462- }
424+ $ module = Module::getInstanceByName ($ name );
425+ return $ module ->isRegisteredInHook ('home ' );
463426 }
464427
465428 /**
@@ -686,27 +649,14 @@ public function hookBackOfficeHeader()
686649 $ js = '' ;
687650 if (strcmp (Tools::getValue ('configure ' ), $ this ->name ) === 0 )
688651 {
689- if (version_compare (_PS_VERSION_ , '1.5 ' , '> ' ) == true )
690- {
691- $ this ->context ->controller ->addCSS ($ this ->_path .'views/css/ganalytics.css ' );
692- if (version_compare (_PS_VERSION_ , '1.6 ' , '< ' ) == true )
693- $ this ->context ->controller ->addCSS ($ this ->_path .'views/css/ganalytics-nobootstrap.css ' );
694- }
695- else
696- {
697- $ js .= '<link rel="stylesheet" href=" ' .$ this ->_path .'views/css/ganalytics.css" type="text/css" />\
698- <link rel="stylesheet" href=" ' .$ this ->_path .'views/css/ganalytics-nobootstrap.css" type="text/css" /> ' ;
699- }
652+ $ this ->context ->controller ->addCSS ($ this ->_path .'views/css/ganalytics.css ' );
700653 }
701654
702655 $ ga_account_id = Configuration::get ('GA_ACCOUNT_ID ' );
703656
704657 if (!empty ($ ga_account_id ) && $ this ->active )
705658 {
706- if (version_compare (_PS_VERSION_ , '1.5 ' , '>= ' ) == true )
707- $ this ->context ->controller ->addJs ($ this ->_path .'views/js/GoogleAnalyticActionLib.js ' );
708- else
709- $ js .= '<script type="text/javascript" src=" ' .$ this ->_path .'views/js/GoogleAnalyticActionLib.js"></script> ' ;
659+ $ this ->context ->controller ->addJs ($ this ->_path .'views/js/GoogleAnalyticActionLib.js ' );
710660
711661 $ this ->context ->smarty ->assign ('GA_ACCOUNT_ID ' , $ ga_account_id );
712662
@@ -852,21 +802,6 @@ public function hookProcessCarrier($params){
852802 }
853803 }
854804
855- protected function checkForUpdates ()
856- {
857- // Used by PrestaShop 1.3 & 1.4
858- if (version_compare (_PS_VERSION_ , '1.5 ' , '< ' ) && self ::isInstalled ($ this ->name ))
859- foreach (array ('2.0.0 ' , '2.0.4 ' , '2.0.5 ' , '2.0.6 ' , '2.1.0 ' ) as $ version )
860- {
861- $ file = dirname (__FILE__ ).'/upgrade/Upgrade- ' .$ version .'.php ' ;
862- if (version_compare (Configuration::get ('GANALYTICS ' ), $ version , '< ' ) && file_exists ($ file ))
863- {
864- include_once ($ file );
865- call_user_func ('upgrade_module_ ' .str_replace ('. ' , '_ ' , $ version ), $ this );
866- }
867- }
868- }
869-
870805 protected function _debugLog ($ function , $ log )
871806 {
872807 if (!$ this ->_debug )
0 commit comments