From 83a8b63860f7b7359e3aa00ffe896f8d2f44b2ac Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 18 May 2012 14:04:03 +0000 Subject: [PATCH] [-] BO : fix #PSCFV-2322 - cannot deactivate multishop with only one shop --- classes/shop/Shop.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 20fe86819..a17928ff0 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -761,11 +761,18 @@ class ShopCore extends ObjectModel } /** - * @return bool Return true if multishop feature is activated + * @return bool Return true if multishop feature is active and at last 2 shops have been created */ public static function isFeatureActive() { - return Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'); + if (!Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) + return false; + + static $total = null; + + if (is_null($total)) + $total = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'shop'); + return ($total > 1) ? true : false; } public function copyShopData($old_id, $tables_import = false, $deleted = false)