Extending Foot - unknown category_url function

I try to extend/modify the footer.html.twig

i copied the twig to modify it in my theme.
at calling frontend i get error 500 cause of „unknown category_url function“ which is in original File

do i have to include something somewhere else in my theme?

It is hard to evaluate, when you have not posted, what changes have you done, but in general, I think you should rather extend the templates, then copy them. Please see Shopware 6: Extending a storefront block.

currently i just copied the original. (like i wrote :slight_smile: )
i´d like to edit the css classes in Block layout_footer_navigation_column

in this block you have links which get there url with <a href="{{ category_url(root.category) }}"

but this causes error

Are you sure, you have copied it correctly from vendor/shopware/storefront/Resources/views/storefront/layout/footer/footer.html.twig to your theme directory?
I have no such thing as category_url in my version of this file. Perhaps you are using some third party theme or plugin, that expects to have category_url method available?
In general, you can create links to categories like this:

`{{ seoUrl('frontend.navigation.page', { navigationId: category.id }) }}`

So whatever you have in there for generating category urls, you can replace it with the fore mentioned code…

1 Like