statamic / cms

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

Collection tag filter multi site problem #7397

Closed lightbringer93 closed 2 months ago

lightbringer93 commented 1 year ago

Bug description

We have a collection of job categories so we can categorise our job ads. On the main jobs page, we would like to display all job categories with the number of vacancies in each category. For this we have created the following snippet.

<div class="grid grid-cols-2 lg:grid-cols-3 justify-center xl:flex gap-4 mt-4 md:mt-8">
    {{ collection:job_categories }}
        {{ if { collection:count in="jobs" job_category:is="{ id }" } > 0 }}
            {{ partial:components/buttons/button class="md:flex-1 job-category" }}
                <span class="font-normal">
                    {{ description ?? title }}<br>
                    {{ partial:components/stats/stat stat="{ collection:count in='jobs' job_category:is='{ id }' }" class="text-4xl lg:text-2xl font-bold" }}
                    {{ translations:open_jobs }}
                </span>
            {{ /partial:components/buttons/button }}
        {{ /if }}
    {{ /collection:job_categories }}
</div>

The if Statement is there so that only those job categories are displayed which actually have job advertisements. This all works now on our first language. But as soon as we open this page in our second and third language, no buttons are displayed. Here is the preview link of our testing enviroment. https://staging.zahnarztzentrum.ch/jobs Apparently, the relationship is no longer resolved correctly in the other languages. The following code {{ collection:count in="jobs" job_category:is="{ id }" }} returns 0.

How to reproduce

Logs

No response

Environment

Environment
Application Name: zahnarztzentrum.ch
Laravel Version: 9.48.0
PHP Version: 8.1.12
Composer Version: 2.0.7
Environment: local
Debug Mode: ENABLED
URL: zahnarztzentrum.test
Maintenance Mode: OFF

Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 5
Antlers: runtime
Stache Watcher: Disabled
Static Caching: Disabled
Version: 3.3.65 PRO

Statamic Addons
jacksleight/statamic-miniset: 0.3.1
parfaitementweb/statamic-country-fieldtype: 1.0.0
raynl/generate-slug: 1.1.1
rias/statamic-address-field: 1.0.3
withcandour/aardvark-seo: 2.0.30

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

lightbringer93 commented 1 year ago

Hi @duncanmcclean do you have any updates on this? We need this for a big website project.

duncanmcclean commented 1 year ago

Hi @duncanmcclean do you have any updates on this? We need this for a big website project.

I'm not on the Statamic Team so I have no idea where this sits on their priority list. I'm just a community member with access to label issues.

duncanmcclean commented 2 months ago

Closing in favour of #3528.