Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap Sections Issue #409

Closed
zadro opened this issue May 27, 2022 · 4 comments · Fixed by #410
Closed

Sitemap Sections Issue #409

zadro opened this issue May 27, 2022 · 4 comments · Fixed by #410

Comments

@zadro
Copy link

zadro commented May 27, 2022

Description

Sitemap.xml is working as expected. However, any of the sitemap section files, ie. "sitemap_sections_1_0.xml" is throwing an error:

Calling unknown method: craft\models\FieldLayout::getFields()

in /home/user/craft/vendor/ether/seo/src/services/SitemapService.php at line 316 – yii\base\Component::__call()

        {
            $fieldLayout =
                $variables['section'] === 'categories' || $variables['section'] === 'productTypes'
                    ? $first->fieldLayout
                    : $first->type->fieldLayout;
 
            foreach ($fieldLayout->getFields() as $field)
                if (get_class($field) === SeoField::class)
                    $seoFieldHandle = $field->handle;
        }
 
        foreach ($elements->all() as $item)
        {

Steps to reproduce

  1. Enabled "dev" mode
  2. Navigated to any sitemap section file

Additional info

  • Craft version: 4.0.3
  • SEO version: 4.0.0
  • PHP version: 8.1.6
  • Database driver & version: MariaDB 10.5.16-MariaDB-1:10.5.16
  • Other Plugins: Redactor 3.0.0
@zadro
Copy link
Author

zadro commented May 28, 2022

Per this update: https://github.com/nystudio107/craft-seomatic/releases/tag/4.0.0-beta.6

It looks like the fix is to change getFields() to getCustomFields()

Please merge and update.

@zadro zadro changed the title Calling unknown method: craft\models\FieldLayout::getFields() Sitemap Sections Issue: Calling unknown method: craft\models\FieldLayout::getFields() May 28, 2022
@zadro zadro changed the title Sitemap Sections Issue: Calling unknown method: craft\models\FieldLayout::getFields() Sitemap Sections Issue May 28, 2022
@moondawg69
Copy link

@zadro I too can confirm the above issue, be nice if it could become a quick fix :)

@niektenhoopen
Copy link
Contributor

@zadro I have implemented your suggestion and it seems to work. I have created PR #410 for it

Tam added a commit that referenced this issue Jun 8, 2022
@Tam Tam closed this as completed in 73698ba Jun 8, 2022
@AnthonyLaSala
Copy link

This also fixed my unrelated Calling unknown method: craft\models\FieldLayout::getFields() issue. Just commenting this so it is more searchable for people. This fix was not easy to find

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 a pull request may close this issue.

4 participants