// Multishop interface reworked

This commit is contained in:
rMalie
2012-05-09 15:05:39 +00:00
parent 5d5f919195
commit 522d7cc950
61 changed files with 6043 additions and 391 deletions
+22 -27
View File
@@ -198,6 +198,7 @@ class ShopCore extends ObjectModel
/**
* Detect dependency with customer or orders
*
* @param int $id_shop
* @return bool
*/
public static function hasDependency($id_shop)
@@ -224,17 +225,6 @@ class ShopCore extends ObjectModel
return $has_dependency;
}
/**
* Get a new instance of a shop
*
* @param int $id shop ID
* @return Shop
*/
public static function getInstance($id)
{
return new Shop($id);
}
/**
* Find the shop from current domain / uri and get an instance of this shop
* if INSTALL_VERSION is defined, will return an empty shop object
@@ -533,6 +523,25 @@ class ShopCore extends ObjectModel
return $results;
}
/**
* Get a collection of shops
*
* @param bool $active
* @param int $id_shop_group
* @return Collection
*/
public static function getShopsCollection($active = true, $id_shop_group = null)
{
$shops = new Collection('Shop');
if ($active)
$shops->where('active', '=', 1);
if ($id_shop_group)
$shops->where('id_shop_group', '=', $id_shop_group);
return $shops;
}
/**
* Return some informations cached for one shop
*
@@ -749,15 +758,11 @@ class ShopCore extends ObjectModel
}
/**
* @return bool Return true if there is more than one shop
* @return bool Return true if multishop feature is activated
*/
public static function isFeatureActive()
{
static $total = null;
if (is_null($total))
$total = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'shop');
return ($total > 1) ? true : false;
return Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE');
}
public function copyShopData($old_id, $tables_import = false, $deleted = false)
@@ -813,16 +818,6 @@ class ShopCore extends ObjectModel
), $m['id_module']);
}
public function checkIfShopExist($id)
{
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM`'._DB_PREFIX_.'shop` WHERE `id_shop` = '.(int)$id);
}
public function checkIfShopGroupExist($id)
{
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM`'._DB_PREFIX_.'shop_group` WHERE `id_shop_group` = '.(int)$id);
}
/**
* @deprecated 1.5.0 Use shop->id
*/