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

Add to/remove from multiple lists in one action #93

Closed
shifuma opened this issue Jul 12, 2021 · 6 comments
Closed

Add to/remove from multiple lists in one action #93

shifuma opened this issue Jul 12, 2021 · 6 comments

Comments

@shifuma
Copy link

shifuma commented Jul 12, 2021

What are you trying to do?
I would like to display a list of a user's lists, and allow them to check which list(s) to add/remove the item to/from.

What's your proposed solution?
This is about as far as I've got...

<form method="POST">
    {{ csrfInput() }}
    <input type="hidden" name="action" value="wishlist/items/update">
    <input type="hidden" name="elementId" value="{{ entry.id }}">
    {% set listsQuery = craft.wishlist.lists().orderBy('elements.dateCreated asc').all() %}
    {% for list in listsQuery %}
        <input id="{{ list.id }}" name="{{ list.id }}" type="checkbox" {{ item.getInList() ? 'checked' }}>
    {% endfor %}
    <input type="submit" value="Save">
</form>

I would appreciate any help in getting this working (if it is indeed possible?)

Thanks!

@engram-design
Copy link
Member

engram-design commented Jul 12, 2021

If you provide a listId param in your request, it'll use that instead of the default list.

<input type="hidden" name="listId" value="{{ list.id }}">

Refer to the note in the docs about this - https://verbb.io/craft-plugins/wishlist/docs/template-guides/managing-items#update-item

@shifuma
Copy link
Author

shifuma commented Jul 12, 2021

Sorry, I might not have made the goal clear enough. I would like the option to add to and remove from multiple lists in one action. So the entry is only in the lists that are checked at the time of save.

@engram-design
Copy link
Member

Ahh, I see. Yep, that's indeed not possible at the moment.

@engram-design engram-design reopened this Jul 12, 2021
@shifuma shifuma changed the title Choose list to add item too Add to/remove from multiple lists in one action Jul 12, 2021
@engram-design engram-design added this to the 3.0 milestone Nov 13, 2022
@chrisrowe
Copy link

Hey Josh - do you have a rough eta for v3?

I need the ability to add items to multiple lists, happy to go down the custom code route but thought I'd check this wasn't planned any time soon

Cheers!

@engram-design
Copy link
Member

No ETA at the moment sorry, but looking to be closer to Q4 2023.

@engram-design
Copy link
Member

Added in 3.0.0

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

No branches or pull requests

3 participants