[*] CORE : Remove duplicate SQL queries

This commit is contained in:
gRoussac
2013-11-11 13:41:23 +01:00
parent de404706d9
commit a7869a1f06
22 changed files with 507 additions and 322 deletions
+12 -6
View File
@@ -112,12 +112,18 @@ class OrderStateCore extends ObjectModel
*/
public static function getOrderStates($id_lang)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
FROM `'._DB_PREFIX_.'order_state` os
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.')
WHERE deleted = 0
ORDER BY `name` ASC');
$cache_id = __CLASS__.__FUNCTION__.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
FROM `'._DB_PREFIX_.'order_state` os
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.')
WHERE deleted = 0
ORDER BY `name` ASC');
Cache::store($cache_id, $result);
}
return Cache::retrieve($cache_id);
}
/**