-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Wishlist shows a completely different entry than the one originally saved #147
Comments
When an element is deleted, the Can you also show what Twig templating you're using on the front-end to render your items? |
Hi @engram-design, I've checked the database for the "broken" wishlist an all ![]() And when I understand your question correct the right-hand side "Element" control is empty but for the wrong item not: ![]() Here is my twig (sprig) code I use to show the wishlists in the frontend: {% set auctionWishlist = craft.wishlist.getUserList({ listType: 'auctionWishlist' }) %}
{% set auctionWishlistItems = false %}
{% set limit = 10 %}
{% set page = page ?? 1 %}
{% set query = query ?? '' %}
{# Fetch the wishlist items with list type handle and current user id and prepare sprig pagination #}
{% if auctionWishlist.id %}
{% set auctionWishlistItems = craft.wishlist.items()
.listTypeHandle('auctionWishlist')
.listId(auctionWishlist.id)
.search(query)
.limit(limit) %}
{% set pageInfo = sprig.paginate(auctionWishlistItems, page) %}
{% set results = pageInfo.pageResults %}
{% endif %}
{% if auctionWishlistItems %}
<div class="@container/listing">
<div id="auction-results">
<ul>
{% if results %}
{% for listItem in results %}
{# Query item from wishlist result #}
{% set item = craft.entries().id(listItem.elementId).one() ?? null %}
{% include '_partials/auctionTableRow.twig' with {
self: item,
context: 'wishlist'
} %}
{% endfor %}
{% else %}
<li class="mt-8">
Die Suche ergab keine Treffer!
</li>
{% endif %}
</ul>
{% if (auctionWishlistItems|length) > limit %}
{% include '_sprig/includes/pagination' %}
{% endif %}
</div>
</div>
{% else %}
Noch keine Merkliste vorhanden!
{% endif %}
If you need more information let me know |
So if you click on one of those wishlist item elements in that table, that was the panel I was interested in. But at least I believe things are looking correct with the The problem I see here is: {% set item = craft.entries().id(listItem.elementId).one() ?? null %} In this instance, You'd be better off calling |
Thanks for confirming that edit screen in the control panel. So this Wishlist item absolutely has a Setting list items |
Hi @engram-design thanks for helping so far. But I'll try to describe the problem again. There are currently 6 items in the wishlist. 5 of them are also in the corresponding table in the database (see screenshot above). But where does the sixth incorrect entry (StefanStrüwind), which is definitely linked in the element picker, come from? There is no possibility in the frontend to add entries of this type to the wishlist. So I am still wondering how it can happen that completely wrong entries appear in the wishlist which are not even in the corresponding table? ![]() ![]() |
Hi @engram-design, I apologise for having expressed myself somewhat imprecisely. In fact, ‘Stefan Strüwind’ is present in the corresponding table with ID and elementID. ![]() I have removed the incorrect entry from the list and will monitor this and open a new issue if it occurs again. Many thanks for your help. Since I want to use the list queries with search and the query also returns items without a linked element, I have solved it in the frontend like this: {% set auctionWishlistItems = craft.wishlist.items()
.listTypeHandle('auctionWishlist')
.listId(auctionWishlist.id)
.elementId(':notempty:')
.search(query)
.limit(limit) %} so my sprig pagination works correct and the problem you showed me with You can close the issue for now 🙏 |
Describe the bug
I have a strange behaviour. I have entries of the auction type, which is content that expires after a certain time. I have a cronjob that deletes the expired entries via a custom module with
$success = Craft::$app->elements->deleteElement($entry);
I don't know if it's the deletion routine or what the cause is. The remembered entries work for a while and then the wishlist suddenly shows completely different entries with a different entry type!
This is how it looks in the cp:
![Image](https://private-user-images.githubusercontent.com/2785206/408199118-e3244d4f-7661-49cd-81b4-8e93a538817e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTM0MzUsIm5iZiI6MTczOTA1MzEzNSwicGF0aCI6Ii8yNzg1MjA2LzQwODE5OTExOC1lMzI0NGQ0Zi03NjYxLTQ5Y2QtODFiNC04ZTkzYTUzODgxN2UucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjIxODU1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmIwODEwZGI5YjA5MmMxOGYxMDZiNWUwZWFlYTU0M2VkZWFkZTc4ZTUzNmY0OTM2MGQxMWEwYTIxNWNlYjIxMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.soFIdQy7UBc4WXWyb7eNOi2TIcASuXyDCZZkA9ch3SA)
It should be an entry of the type auction but in the frontend it shows an complete wrong entry. If multiple items on the list it shoes the same wrong entry for each item:
So far I have no idea what this could be due to. I have already deleted the list type and created a new one, but the error keeps recurring 😢
Steps to reproduce
Craft CMS version
Craft CMS PRO 5.5.10
Plugin version
3.0.4
Multi-site?
No
Additional context
No response
The text was updated successfully, but these errors were encountered: