// Improve ergonomy of configuration for multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7879 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-03 18:06:51 +00:00
parent f2b5ee338b
commit 06cc9cff99
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
*