verbb / wishlist

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

Add support for creating list and adding items to it immediately #100

Closed engram-design closed 1 month ago

engram-design commented 2 years ago

Similar to https://github.com/verbb/wishlist/issues/93 and https://github.com/verbb/wishlist/issues/81 and will likely require some centralised mechanism to keep these things organised

jckvnr commented 2 years ago

This would be awesome - I have a lot of clients requesting this functionality

martyspain commented 2 years ago

I've done this with Wishlist using JS and Promises with the existing endpoints and that works well enough, but it would be nice to have official support for creating a list and adding an item to it in one go.

estebancastro commented 1 year ago

@martyspain Can you please show me an example of how you do create the list and add the item it immediately with JS and Promises? Thank You.

note: I don't use the form element to Add, Remove, Update or Toggle items, simply I use the URL, like:

{% for entry in craft.entries.section('news').all() %}
    {% set item = craft.wishlist.item(entry.id) %}
    <a href="{{ item.addUrl() }}">Add to List</a>
{% endfor %}

so I don't know how trigger the actions through JavaScript like this example: https://verbb.io/craft-plugins/wishlist/docs/template-guides/managing-items#submit-with-javaScript

engram-design commented 1 month ago

Added in 3.0.0