public static function getArchive() { $result = array(); $sql = 'SELECT YEAR(p.created) as year FROM ' . _DB_PREFIX_ . 'smart_blog_post p INNER JOIN ' . _DB_PREFIX_ . 'smart_blog_post_shop ps ON p.id_smart_blog_post = ps.id_smart_blog_post AND ps.id_shop = ' . (int) Context::getContext()->shop->id . ' GROUP BY YEAR(p.created)'; if (!($posts = Db::getInstance()->executeS($sql))) { return false; } $i = 0; foreach ($posts as $value) { $result[$i]['year'] = $value['year']; $result[$i]['month'] = SmartBlogPost::getArchiveM($value['year']); $months = SmartBlogPost::getArchiveM($value['year']); $j = 0; foreach ($months as $month) { $result[$i]['month'][$j]['day'] = SmartBlogPost::getArchiveD($month['month'], $value['year']); $j++; } $i++; } return $result; }