Sylius: Taxon menu is not available

Created on 17 Nov 2020  路  6Comments  路  Source: Sylius/Sylius

Maybe is not an issue but after created many taxons, the menu is not available in the top bar.
I don't find how to show it.

Potential Bug

Most helpful comment

I found the problem.
Overriding vendor/sylius/bootstrap-theme/SyliusShopBundle/views/Layout/Header/_menu.html.twig is fixing my empty taxons issue :

{#  {{ render(url('sylius_shop_partial_taxon_index_by_code', {'code': 'category', 'template': '@SyliusShop/Taxon/_horizontalMenu.html.twig'})) }}#}
{{ render(url('sylius_shop_partial_channel_menu_taxon_index', {'template': '@SyliusShop/Taxon/_horizontalMenu.html.twig'})) }}

use sylius_shop_partial_channel_menu_taxon_index route instead of sylius_shop_partial_taxon_index_by_code ;)

All 6 comments

Hi @jubaron! Please, tell me, how many taxons did you create? Do the just not show up or there is some exception thrown? Maybe you could also try to dump taxons variable in src/Sylius/Bundle/ShopBundle/Resources/views/Taxon/_horizontalMenu.html.twig and show the result?

I have 3 taxons. {{dump(taxon)}} return empty array
I don't kown if there is link but I found this error in apache log :
[Thu Nov 19 20:54:59.250508 2020] [php7:error] [pid 9748:tid 1652] [client 127.0.0.1:53031] PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Return value of Sylius\Component\Core\Model\Channel::getLocales() must implement interface Doctrine\Common\Collections\Collection, null returned in C:\xampp7.4\htdocs\Boutique\vendor\sylius\sylius\src\Sylius\Component\Core\Model\Channel.php:158\nStack trace:\n#0 C:\xampp7.4\htdocs\Boutique\vendor\sylius\sylius\src\Sylius\Component\Core\Provider\ChannelBasedLocaleProvider.php(43): Sylius\Component\Core\Model\Channel->getLocales()\n#1 C:\xampp7.4\htdocs\Boutique\vendor\sylius\sylius\src\Sylius\Bundle\LocaleBundle\Context\RequestBasedLocaleContext.php(47): Sylius\Component\Core\Provider\ChannelBasedLocaleProvider->getAvailableLocalesCodes()\n#2 C:\xampp7.4\htdocs\Boutique\vendor\sylius\sylius\src\Sylius\Component\Locale\Context\CompositeLocaleContext.php(43): Sylius\Bundle\LocaleBundle\Context\RequestBasedLocaleContext->getLocaleCode()\n#3 C:\xampp7.4\htdocs\Boutique\vendor\sylius\sylius\src\Sylius\Bundle\LocaleBundle\Listener\RequestLocaleSetter.php(44) in C:\xampp7.4\htdocs\Boutique\vendor\sylius\sylius\src\Sylius\Component\Core\Model\Channel.php on line 158

The only question that came to my mind is - do you have a menu taxon set on the Channel form?

Zrzut ekranu 2020-11-20 o 08 39 11

If it's not set it gets CATEGORY taxon by default, as far as I remember

I try with and without, no effect...

Hi there,

I have the same issue using sylius/bootstrap-theme dev-master theme (with child or parent theme : taxons are empty in Resources/views/Taxon/_horizontalMenu.html.twig).

Menu taxon is well configured in channel form.

There is no problem with default SemanticUI ShopBundle.

I'am using sylius 1.8 .

If somebody have an idea ... I'am interested.

If I find a solution, I will report it here.

Thank you

I found the problem.
Overriding vendor/sylius/bootstrap-theme/SyliusShopBundle/views/Layout/Header/_menu.html.twig is fixing my empty taxons issue :

{#  {{ render(url('sylius_shop_partial_taxon_index_by_code', {'code': 'category', 'template': '@SyliusShop/Taxon/_horizontalMenu.html.twig'})) }}#}
{{ render(url('sylius_shop_partial_channel_menu_taxon_index', {'template': '@SyliusShop/Taxon/_horizontalMenu.html.twig'})) }}

use sylius_shop_partial_channel_menu_taxon_index route instead of sylius_shop_partial_taxon_index_by_code ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ping86 picture ping86  路  3Comments

mezoni picture mezoni  路  3Comments

igormukhingmailcom picture igormukhingmailcom  路  3Comments

inssein picture inssein  路  3Comments

stefandoorn picture stefandoorn  路  3Comments