Jump to content

Invalid category parameter


SmarThuis

Recommended Posts

Uncaught PHP Exception InvalidArgumentException: "Invalid category parameter" at /home/smarthuis/domains/smarthuis.nl/public_html/classes/Link.php line 448 
 

When I try to generate a SiteMap

InvalidArgumentException: Invalid category parameter at classes/Link.php:448 at LinkCore->getCategoryLink() (modules/gsitemap/gsitemap.php:537) at Gsitemap->getCategoryLink() (modules/gsitemap/gsitemap.php:755) at Gsitemap->createSitemap() (modules/gsitemap/gsitemap.php:208) at Gsitemap->getContent() (controllers/admin/AdminModulesController.php:696) at AdminModulesControllerCore->postProcessCallback() (controllers/admin/AdminModulesController.php:921) at AdminModulesControllerCore->postProcess() (classes/controller/Controller.php:308) at ControllerCore->run() (classes/Dispatcher.php:510) at DispatcherCore->dispatch() (admin187eh0u242qqbazbsdy/index.php:95)

Scherm­afbeelding 2024-05-09 om 10.59.47.png

Link to comment
Share on other sites

  • 1 year later...

It’s very likely your category has no language row in ps_category_lang for the language you’re generating, so the module’s getCategoryLink() ends up working with an unloaded Category and still tries to read its properties. The weak guard is inside the module’s getCategoryLink() (the sitemap method). You can pinpoint the offending record with a quick dump:

// inside modules/gsitemap/... getCategoryLink()
dump($category_id);

$category = new Category((int) $category_id['id_category'], (int) $lang['id_lang']);

if (empty($category->id_category)) {
    dump($category);
    die;
}

The loop will stop on the problematic category when you try to generate the sitemap, meaning that this category is missing its language entry (or isn’t properly loaded).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...