verbb / wishlist

A Craft CMS plugin for wishlists for your users to save things to
Other
11 stars 12 forks source link

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

Closed shifuma closed 1 month ago

shifuma commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

chrisrowe commented 10 months ago

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 commented 10 months ago

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

engram-design commented 1 month ago

Added in 3.0.0