Skip to content

TaxonsListContentElementRenderer ignores the configured taxon order and renders disabled taxons #204

Description

@JustMordeckai

Problem

TaxonsListContentElementRenderer::render() fetches the configured taxons with a bare findBy:

https://github.com/Sylius/CmsPlugin/blob/v1.1.6/src/Renderer/ContentElement/TaxonsListContentElementRenderer.php#L38

$configuration['taxons_list']['taxons'] holds the codes in the order the contributor picked them in the admin form, but findBy(['code' => $codes]) returns rows in database order, so that order is thrown away. And since there is no enabled filter, taxons that were disabled in the catalog keep being rendered by the element while the rest of the shop hides them.

Steps to reproduce

  1. Create three taxons A, B and C (A created first).
  2. Add a taxons_list content element to a page and select the taxons in the order C, A, B.
  3. Render the page on the shop: the list shows A, B, C (database order), not C, A, B.
  4. Disable B in the catalog and reload the page: B is still rendered.

Expected behaviour

The element renders the taxons in the order they were selected in the admin, and skips disabled taxons, consistently with how the shop treats disabled taxons everywhere else. This is the same family of problem as #119, which covers disabled products in the products grid/carousel elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions