@@ -62,47 +62,21 @@ public function __construct()
6262 $ this ->psVersionIs17 = (bool ) version_compare (_PS_VERSION_ , '1.7 ' , '>= ' );
6363 }
6464
65- public function displayForm ()
66- {
67- $ configurationForm = new PrestaShop \Module \Ps_Googleanalytics \Form \ConfigurationForm ($ this );
68- return $ configurationForm ->generateForm ();
69- }
70-
7165 /**
7266 * back office module configuration page content
7367 */
7468 public function getContent ()
7569 {
76- $ output = '' ;
70+ $ configurationForm = new PrestaShop \Module \Ps_Googleanalytics \Form \ConfigurationForm ($ this );
71+ $ formOutput = '' ;
72+
7773 if (Tools::isSubmit ('submit ' .$ this ->name )) {
78- $ ga_account_id = Tools::getValue ('GA_ACCOUNT_ID ' );
79- if (!empty ($ ga_account_id )) {
80- Configuration::updateValue ('GA_ACCOUNT_ID ' , $ ga_account_id );
81- Configuration::updateValue ('GANALYTICS_CONFIGURATION_OK ' , true );
82- $ output .= $ this ->displayConfirmation ($ this ->l ('Account ID updated successfully ' ));
83- }
84- $ ga_userid_enabled = Tools::getValue ('GA_USERID_ENABLED ' );
85- if (null !== $ ga_userid_enabled ) {
86- Configuration::updateValue ('GA_USERID_ENABLED ' , (bool )$ ga_userid_enabled );
87- $ output .= $ this ->displayConfirmation ($ this ->l ('Settings for User ID updated successfully ' ));
88- }
89-
90- $ ga_crossdomain_enabled = Tools::getValue ('GA_CROSSDOMAIN_ENABLED ' );
91- if (null !== $ ga_crossdomain_enabled ) {
92- Configuration::updateValue ('GA_CROSSDOMAIN_ENABLED ' , (bool )$ ga_crossdomain_enabled );
93- $ output .= $ this ->displayConfirmation ($ this ->l ('Settings for User ID updated successfully ' ));
94- }
95-
96- $ ga_anonymize_enabled = Tools::getValue ('GA_ANONYMIZE_ENABLED ' );
97- if (null !== $ ga_anonymize_enabled ) {
98- Configuration::updateValue ('GA_ANONYMIZE_ENABLED ' , (bool )$ ga_anonymize_enabled );
99- $ output .= $ this ->displayConfirmation ($ this ->l ('Settings for Anonymize IP updated successfully ' ));
100- }
74+ $ formOutput = $ configurationForm ->treat ();
10175 }
10276
103- $ output .= $ this -> displayForm ();
77+ $ formOutput .= $ configurationForm -> generate ();
10478
105- return $ this ->display (__FILE__ , './views/templates/admin/configuration.tpl ' ). $ output ;
79+ return $ this ->display (__FILE__ , './views/templates/admin/configuration.tpl ' ) . $ formOutput ;
10680 }
10781
10882 public function hookdisplayHeader ($ params , $ back_office = false )
0 commit comments