Skip to content

Blog header rail: only list top-level categories - #274

Merged
CySSoO merged 1 commit into
TeamEver:masterfrom
nicohery:fix/blog-rail-top-level-categories
Aug 27, 2026
Merged

CySSoO merged 1 commit into
TeamEver:masterfrom
nicohery:fix/blog-rail-top-level-categories

Conversation

@nicohery

Copy link
Copy Markdown
Contributor

Problem

The blog index (/blog) header rail loops over every active category. As soon as the blog uses sub-categories (e.g. a "Recipes" category with "Desserts", "Drinks"… children), all of them appear at the top level of the rail, next to their parent — while the category page already lists its children ($children_categories in category.tpl).

Fix

  • controllers/front/blog.php: select c.id_parent_category alongside the existing columns in getFrontLocalizedCategories().
  • views/themes/default/front/blog.tpl: resolve the root category id from the list, and only render categories whose parent is the root. Falls back to the previous behaviour when no root is present or the column is missing.

No change for blogs without sub-categories (every category has the root as parent).

Tests

Verified on PS 9.1.3: with 5 top-level categories and 10 sub-categories under one of them, the rail shows the 5 top-level ones; the parent's page still lists its 10 children.

@CySSoO
CySSoO merged commit 917b39d into TeamEver:master Aug 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants