Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying entries from entry field uses wrong siteId #319

Open
jan-dh opened this issue Oct 23, 2024 · 3 comments
Open

Querying entries from entry field uses wrong siteId #319

jan-dh opened this issue Oct 23, 2024 · 3 comments

Comments

@jan-dh
Copy link

jan-dh commented Oct 23, 2024

Describe the bug

image

As you can see in the image; the siteId that's being used in the DB query is 9, the currentSite.id is 8.

I can manually work around this like this:

{# Get ID from the query #}
{% set id = one_cta.id[0] %}
{# Manually query craft with the id #}
{% set cta = craft.entries.section('cta').id(id).one() %}
{% if cta %}
  <pre>
    {{ dump(cta.title) }}
  </pre>
{% endif %}

Steps to reproduce

  1. Create a new vizy block with an entry field type
  2. Link an entry
  3. Output the templates with node.renderHtml()

Craft CMS version

4.12.8

Plugin version

2.1.23

Multi-site?

Yes

Additional context

The site that is used in the DB query is from another sitegroup

@engram-design
Copy link
Member

engram-design commented Oct 24, 2024

Can you provide any further clarification on the entries picked? Were they from the same site, or cross-site?

We don't actually store the site for the picked entries (that's because the Craft Entries field doesn't do that). But wondering if you can post your Entries field (the one used in your Vizy block) settings so I can confirm?

@jan-dh jan-dh closed this as completed Oct 25, 2024
@jan-dh jan-dh reopened this Oct 25, 2024
@jan-dh
Copy link
Author

jan-dh commented Oct 25, 2024

The entries selected are indeed from the same site.
So entry I link the other entries from: siteId:8
Entries I link: siteId: 8

Field type: Entries
Sources: 1 channel called - CTA's

image

@engram-design
Copy link
Member

Thanks for confirming. Still struggling to reproduce that, but will keep trying on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants