Witam!
Czy ktoś wie w jaki sposób można w opencart wygenerować klasyczną 3-poziomową listę UL z kategoriami?
			
		$categories_1 = $this->model_catalog_category->getCategories(0);
$cat_str = '<ul>';
foreach ($categories_1 as $category_1) {
    $cat_str .= '<li>';
    $cat_str .= '<a href="">' . $category_1['name'] . '</a>';
    $categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
    if ($categories_2) $cat_str  .= '<ul>';
    foreach ($categories_2 as $category_2) {
        $cat_str .= '<li>';
        $cat_str .= '<a href="">' . $category_2['name'] . '</a>';
        $categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);
        if ($categories_3) $cat_str  .= '<ul>';
        foreach ($categories_3 as $category_3) {
            $cat_str .= '<li>';
            $cat_str .= '<a href="">' . $category_3['name'] . '</a>';
            $cat_str .= '</li>';
        }
        if ($categories_3) $cat_str  .= '</ul>';
        $cat_str .= '</li>';
    }
    if ($categories_2) $cat_str  .= '</ul>';
    $cat_str .= '</li>';
}
$cat_str .= '</ul>';
Powrót do Pomoc techniczna przy Opencart
Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 0 gości