public static function getAllCMSStructure($id_shop = false) { $id_shop = $id_shop != false ? $id_shop : Context::getContext()->shop->id; $categories = BlockCMSModel::getCMSCategories(false, 0, $id_shop); foreach ($categories as $key => $value) { $categories[$key]['cms_pages'] = BlockCMSModel::getCMSPages($value['id_cms_category'], $id_shop); } return $categories; }
public static function getCMSTitles($location, $id_shop = false) { $content = array(); $context = Context::getContext(); $cmsCategories = BlockCMSModel::getCMSCategoriesByLocation($location, $id_shop); $cmsPages = array(); if (is_array($cmsCategories) && count($cmsCategories)) { foreach ($cmsCategories as $cmsCategory) { $cmsPages = BlockCMSModel::getCMSPages((int) $cmsCategory['id_cms_category']); if (is_array($cmsPages) && count($cmsPages)) { foreach ($cmsPages as $cmsPage) { $key = (int) $cmsPage['id_cms']; $content[$key]['date_event'] = $cmsPage['date_event']; $content[$key]['meta_title'] = $cmsPage['meta_title']; $content[$key]['cms_link'] = $context->link->getCMSLink((int) $cmsPage['id_cms'], $cmsPage['link_rewrite']); } /* $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block'], $id_shop); $links = array(); if (count($content[$key]['cms'])) { foreach ($content[$key]['cms'] as $row) { $row['link'] = $context->link->getCMSLink((int)$row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['cms'] = $links; $content[$key]['categories'] = BlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['categories'])) { foreach ($content[$key]['categories'] as $row) { $row['link'] = $context->link->getCMSCategoryLink((int)$row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['categories'] = $links; $content[$key]['name'] = $cmsCategory['block_name']; $content[$key]['category_link'] = $context->link->getCMSCategoryLink((int)$cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']); $content[$key]['category_name'] = $cmsCategory['category_name']; */ } } } return $content; }