Skip to content

Commit cdb4afb

Browse files
committed
Display new option only if multistore is active
1 parent 195aa5d commit cdb4afb

1 file changed

Lines changed: 23 additions & 16 deletions

File tree

ps_googleanalytics.php

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ protected function deleteTables()
118118

119119
public function displayForm()
120120
{
121+
// Check if multistore is active
122+
$is_multistore_active = Shop::isFeatureActive();
123+
121124
// Get default language
122125
$default_lang = (int)Configuration::get('PS_LANG_DEFAULT');
123126

@@ -182,27 +185,31 @@ public function displayForm()
182185
'label' => $this->l('Disabled')
183186
))
184187
),
185-
array(
186-
'type' => 'switch',
187-
'label' => $this->l('Enable Cross-Domain tracking'),
188-
'name' => 'GA_CROSSDOMAIN_ENABLED',
189-
'values' => array(
190-
array(
191-
'id' => 'ga_crossdomain_enabled',
192-
'value' => 1,
193-
'label' => $this->l('Enabled')
194-
),
195-
array(
196-
'id' => 'ga_crossdomain_disabled',
197-
'value' => 0,
198-
'label' => $this->l('Disabled')
199-
))
200-
),
201188
),
202189
'submit' => array(
203190
'title' => $this->l('Save'),
204191
)
205192
);
193+
194+
if ($is_multistore_active) {
195+
$fields_form[0]['form']['input'][] = array(
196+
'type' => 'switch',
197+
'label' => $this->l('Enable Cross-Domain tracking'),
198+
'name' => 'GA_CROSSDOMAIN_ENABLED',
199+
'values' => array(
200+
array(
201+
'id' => 'ga_crossdomain_enabled',
202+
'value' => 1,
203+
'label' => $this->l('Enabled')
204+
),
205+
array(
206+
'id' => 'ga_crossdomain_disabled',
207+
'value' => 0,
208+
'label' => $this->l('Disabled')
209+
)
210+
)
211+
);
212+
}
206213

207214
// Load current value
208215
$helper->fields_value['GA_ACCOUNT_ID'] = Configuration::get('GA_ACCOUNT_ID');

0 commit comments

Comments
 (0)