Skip to content

Skip meta pages whose route requires mandatory parameters in sitemap#196

Open
boo-code wants to merge 1 commit into
PrestaShop:devfrom
boo-code:fix/sitemap-skip-routes-requiring-params
Open

Skip meta pages whose route requires mandatory parameters in sitemap#196
boo-code wants to merge 1 commit into
PrestaShop:devfrom
boo-code:fix/sitemap-skip-routes-requiring-params

Conversation

@boo-code

Copy link
Copy Markdown
Questions Answers
Description? getMetaLink() builds a sitemap entry for every configurable meta page via Link::getPageLink($meta['page'], ...). When a meta page maps to a route that requires a mandatory parameter (e.g. a module search route needing an id), Dispatcher::createUrl() throws a PrestaShopException, which aborted the entire sitemap generation. This PR catches that exception and skips the offending page so generation continues. Such routes cannot be represented in a sitemap without a specific parameter value, so skipping them is the expected behaviour.
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #193.
How to test? Install a module that registers a meta page mapping to a route with a required parameter (issue example: module-pm_advancedsearch-searchresults requiring id_search), then generate the sitemap from the gsitemap configuration page. Before this PR generation fails with Dispatcher::createUrl() miss required parameter ...; after it the sitemap is generated and the route is silently skipped. This is reproducible with a core route too: Link::getPageLink('upload', null, $idLang) throws (the upload route requires file) — with the fix, getMetaLink() skips it and returns normally instead of aborting.
Sponsor company

getMetaLink() calls Link::getPageLink() for every configurable meta page.
When a meta page maps to a route that requires a mandatory parameter
(e.g. a module search route needing an id), Dispatcher::createUrl() throws
a PrestaShopException, which aborted the entire sitemap generation.

Such routes cannot be represented in a sitemap without a specific value, so
catch the exception and skip the page, letting generation continue.
@ps-jarvis

Copy link
Copy Markdown

Hello @boo-code!

This is your first pull request on gsitemap repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

[BUG] Dispatcher::createUrl() miss required parameter "id_search" for route "module-pm_advancedsearch-searchresults"

2 participants