php - Split Opencart Sitemap into multiple columns -
i using opencart 2.0.1.1 , in information/sitemap, categories in site map listed in 1 column , since have lots of categories generating long list in 1 column.
i trying figure out if can split categories in multiple columns make good. tried using array_chunk or inserting if condition split different columns doesn't work. current code.
$data['categories'] = array(); $categories_1 = $this->model_catalog_category->getcategories(0); foreach ($categories_1 $category_1) { $level_2_data = array(); $categories_2 = $this->model_catalog_category->getcategories($category_1['category_id']); foreach ($categories_2 $category_2) { $level_3_data = array(); $categories_3 = $this->model_catalog_category->getcategories($category_2['category_id']); foreach ($categories_3 $category_3) { $level_3_data[] = array( 'name' => $category_3['name'], 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id']) ); } $level_2_data[] = array( 'name' => $category_2['name'], 'children' => $level_3_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id']) ); } $data['categories'][] = array( 'name' => $category_1['name'], 'children' => $level_2_data, 'href' => $this->url->link('product/category', 'path=' . $category_1['category_id']) ); }
solved using css multi column property:
column-count column-gap column-rule-style column-rule-width column-rule-color column-rule column-span column-width
although not grid, job in dividing 1 column multiple columns. not ideal solution doing job.
Comments
Post a Comment