// Some optimization #PI-121

This commit is contained in:
rMalie
2012-04-18 09:57:19 +00:00
parent f045723c3c
commit 3a2bb555eb
8 changed files with 82 additions and 122 deletions
-26
View File
@@ -491,7 +491,6 @@ class ShopCore extends ObjectModel
'name' => $row['group_name'],
'share_customer' => $row['share_customer'],
'share_order' => $row['share_order'],
'totalShops' => Shop::getTotalShopsByIdShopGroup($row['id_shop_group']),
'shops' => array(),
);
@@ -573,31 +572,6 @@ class ShopCore extends ObjectModel
return count(Shop::getShops($active));
}
/**
* @return int Total of shops
*/
public static function getTotalShopsWhoExists()
{
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'shop`');
}
/**
* @return int Total of shops
*/
public static function getTotalShopsByIdShopGroup($id)
{
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'shop` WHERE `id_shop_group` = '.(int)$id);
}
public static function getIdShopsByIdShopGroup($id)
{
$result = Db::getInstance()->executeS('SELECT `id_shop`, `id_shop_group` FROM `'._DB_PREFIX_.'shop` WHERE `id_shop_group` = '.(int)$id);
$data = array();
foreach ($result as $group_data)
$data[] = (int)$group_data['id_shop'];
return $data;
}
/**
* Retrieve group ID of a shop
*