statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.69k stars 507 forks source link

Can't filter by linked entries in multisite setup #3528

Open goellner opened 3 years ago

goellner commented 3 years ago

When using an entries field to filter the results in a collection tag, it does not work in a multisite setup.

Example:

A collection shows with an entries field called productions, where the user selects one entry from another collection called shows.

This tag works fine on the default locale, but it shows no results on all other locales.

{{ collection from="shows" :production:is="id" sort="show_date:asc" }}
  {{ if no_results }}
  no results
  {{ else }}
  {{ title }}
  {{/if }}
{{ /collection }}

It looks like the entries have different ids on all locales. The linked production is not translatable on all other locales, so it only has to be set once.

How to Reproduce

  1. Add collection productions
  2. Add collection shows with an entry field where you set max items to 1 and the collection to productions
  3. create a template with the collection tag from above
  4. create at least a second locale
  5. everything is working fine on the default locale, but not on all other locales

Extra Detail

This also applies when trying to do something like this: {{ 'ef2da943-c556-4a0f-9d71-73b37bfad38c' | get:url }} for hardcoded links in a template. This also only works on the default locale, because the entries have different ids. Question: why do the entries need different ids?

Environment

Statamic 3.1.6 Pro Laravel 8.33.1 PHP 7.4.15 jonassiewertsen/statamic-livewire 2.5.0 spatie/statamic-responsive-images 2.5.3 statamic/seo-pro 2.1.5

Install method (choose one):

goellner commented 3 years ago

I went ahead and set up a demo repo for this bug: https://github.com/goellner/statamic-relations

On the movies detail page, it works in the default locale en but not in the second one de.

Working here: http://statamic-relations.test/movies/lord-of-the-rings Not working here: http://statamic-relations.test/de/filme/lord-of-the-rings

yobottehg commented 2 years ago

Is there any update on this or a workaround? We ran into the same today and our current workaround would be to create custom tags for the collection listings.

Any insights would be valuable :)

justkidding96 commented 1 month ago

@jasonvarga Any update about this issue? It is still relevant in version 5.

duncanmcclean commented 1 month ago

Unfortunatley, I don't have a fix for this.

However, I've created a new example repo on Statamic 5, using @goellner's example, for whenever we get around to looking into this: https://github.com/duncanmcclean/cms-3528

justkidding96 commented 2 days ago

+1