addCategoryGroup Service not working
Hi,
Nice plugin, but the service addCategoryGroup doesn't work.
Your example code is:
$group = craft()->categories->getGroupByHandle('news'); craft()->sitemap->addCategoryGroup($group);
But it doesn't return any categories, because this line isn't right (Line 145 - SitemapService.php): $criteria->group = $categoryGroup;
The parameter expects a string, but you're putting in the whole CategoryGroupModel instead. There are two options of fixing:
- Change the function to: public function addCategoryGroup($categoryGroup, $changefreq = null, $priority = null)
And change the example code to: craft()->sitemap->addCategoryGroup('news');
- Or change line 145 to: $criteria->group = $categoryGroup->handle;
Hope this helps, Ruben
Thanks, Ruben.
Care to ping over a PR? :wink:
On 2 Dec 2015, at 11:38 a.m., Ruben [email protected] wrote:
Hi,
Nice plugin, but the service addCategoryGroup doesn't work.
Your example code is:
$group = craft()->categories->getGroupByHandle('news'); craft()->sitemap->addCategoryGroup($group);
But it doesn't return any categories, because this line isn't right (Line 145 - SitemapService.php): $criteria->group = $categoryGroup;
The parameter expects a string, but you're putting in the whole CategoryGroupModel instead. There are two options of fixing:
Change the function to: public function addCategoryGroup($categoryGroup, $changefreq = null, $priority = null) And change the example code to: craft()->sitemap->addCategoryGroup('news');
Or change line 145 to: $criteria->group = $categoryGroup->handle; Hope this helps, Ruben
— Reply to this email directly or view it on GitHub.
Like so?