// Improve ergonomy of configuration for multishop

This commit is contained in:
rMalie
2011-08-03 18:06:51 +00:00
parent 83734c7bb9
commit a56e15cf00
4 changed files with 103 additions and 57 deletions
+19
View File
@@ -405,6 +405,25 @@ class ConfigurationCore extends ObjectModel
return false;
}
public static function isOverridenByCurrentContext($key)
{
if (Configuration::isLangKey($key))
{
$testContext = false;
foreach (Language::getLanguages(false) as $lang)
if ((Context::shop() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_SHOP))
|| (Context::shop() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, $lang['id_lang'], Shop::CONTEXT_GROUP)))
$testContext = true;
}
else
{
$testContext = ((Context::shop() == Shop::CONTEXT_SHOP && Configuration::hasContext($key, null, Shop::CONTEXT_SHOP))
|| (Context::shop() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, null, Shop::CONTEXT_GROUP))) ? true : false;
}
return (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && $testContext);
}
/**
* Check if a key was loaded as multi lang
*