diff --git a/admin-dev/tabs/AdminPreferences.php b/admin-dev/tabs/AdminPreferences.php
index 35db529f8..5c13c3b7a 100644
--- a/admin-dev/tabs/AdminPreferences.php
+++ b/admin-dev/tabs/AdminPreferences.php
@@ -358,19 +358,28 @@ class AdminPreferences extends AdminTab
if (isset($field['required']) AND $field['required'])
$required = true;
$val = $this->getVal($confValues, $key);
+
+ // Check if var is invisible (can't edit it in current shop context), or disable (use default value for multishop)
+ $isDisabled = $isInvisible = false;
+ if (Shop::isMultiShopActivated())
+ {
+ if (isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType())
+ {
+ $isDisabled = true;
+ $isInvisible = true;
+ }
+ else if (Context::shop() != Shop::CONTEXT_ALL && !Configuration::isOverridenByCurrentContext($key))
+ $isDisabled = true;
+ }
if (!in_array($field['type'], array('image', 'radio', 'container', 'container_end')) OR isset($field['show']))
{
- echo '
';
- $this->getHtmlDefaultConfigurationValue($key, $languages);
-
+ echo '
';
if ($field['title'])
- echo '
';
+ echo '
';
echo '
';
}
- $isDisabled = (Shop::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType()) ? true : false;
-
/* Display the appropriate input type for each field */
switch ($field['type'])
{
@@ -485,16 +494,20 @@ class AdminPreferences extends AdminTab
break;
case 'maintenance_ip':
- echo '
'.(isset($field['next']) ? ' '.strval($field['next']) : '').'  
'.$this->l('Add my IP').'';
+ echo '
'.(isset($field['next']) ? ' '.strval($field['next']) : '').'  
'.$this->l('Add my IP').'';
break;
case 'text':
default:
- echo '
'.(isset($field['next']) ? ' '.strval($field['next']) : '');
+ echo '
'.(isset($field['next']) ? ' '.strval($field['next']) : '');
}
echo ((isset($field['required']) AND $field['required'] AND !in_array($field['type'], array('image', 'radio'))) ? '
*' : '');
- echo (isset($field['desc']) ? '
'.((isset($field['thumb']) AND $field['thumb'] AND $field['thumb']['pos'] == 'after') ? '
' : '' ).$field['desc'].'
' : '');
- echo ($isDisabled) ? '
'.$this->l('You can\'t change the value of this configuration field in this shop context').'
' : '';
+
+ if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible)
+ echo '
';
+
+ echo (isset($field['desc']) ? '
'.((isset($field['thumb']) AND $field['thumb'] AND $field['thumb']['pos'] == 'after') ? '
' : '' ).$field['desc'].'
' : '');
+ echo ($isInvisible) ? '
'.$this->l('You can\'t change the value of this configuration field in this shop context').'
' : '';
if (!in_array($field['type'], array('image', 'radio', 'container', 'container_end')) OR isset($field['show']))
echo '
';
}
diff --git a/classes/AdminTab.php b/classes/AdminTab.php
index 76c9f4fbb..342a424a9 100644
--- a/classes/AdminTab.php
+++ b/classes/AdminTab.php
@@ -93,6 +93,8 @@ abstract class AdminTabCore
/** @var array Fields to display in list */
public $fieldsDisplay = array();
+ public $optionTitle = null;
+
/** @var string shop | group_shop */
public $shopLinkType;
@@ -152,6 +154,8 @@ abstract class AdminTabCore
/** @var bool If false, don't add form tags in options forms */
protected $formOptions = true;
+
+ public $_fieldsOptions = array();
protected $_languages = NULL;
protected $_defaultFormLanguage = NULL;
@@ -1677,25 +1681,25 @@ abstract class AdminTabCore
{
if (is_null($fieldsOptions))
$fieldsOptions = $this->_fieldsOptions;
-
- if (is_null($optionTitle))
- $optionTitle = $this->optionTitle;
if (!isset($fieldsOptions) OR !sizeof($fieldsOptions))
return false;
-
+
+ if (is_null($optionTitle))
+ $optionTitle = $this->optionTitle;
+
$defaultLanguage = (int)$this->context->language->id;
$this->_languages = Language::getLanguages(false);
$tab = Tab::getTab($defaultLanguage, $this->id);
echo '
';
- echo (isset($optionTitle) ? '
'.$optionTitle.'
' : '');
+ echo ($optionTitle ? '
'.$optionTitle.'
' : '');
echo '
'.(($this->formOptions) ? '
';
}
echo '