I am facing a use case where I might need several wishlists to be available to the user. Since the commerce order system allows multiple simultaneous orders per user (you can also have multiple carts #1350342: Multiple cart instances), this should be possible as well.

This would introduce a new database table containing a wishlist name and the corresponding order id (and probably uid for fast indexing). The add to wishlist submission needs some rewriting and hook_menu might need some changes to allow sub-pages, together with some smaller changes.

But it would allow more options for people to, for example have a separate birthday and Christmas wishlist. Combined with public viewable wishlists, this could be a strong feature where you could share one link with a certain group of people and another link with another group.

I am willing to investigate and write the required changes for this, if you would agree on implementing this.

Comments

aramboyajyan’s picture

Status: Active » Needs work

Sounds good! I was thinking about that actually, but it was far off from the project I needed the wishlist for in the first place, so I didn't do it.

I'll think about it these days and keep this issue posted with any ideas / outline.

neograph734’s picture

Great. I made a start with it already and expect to have something within a few days.

aramboyajyan’s picture

Here are some quick thoughts till I didn't forget:

- The add to cart element should be altered to include a select list of user's wishlists. If the user doesn't have any wishlists, we can display a textfield instead where the user can enter the name for new wishlist.
- We need a new Views field element that will expose the Wishlist title; this might be necessary for the search/filter functionality
- Regarding the hook_menu(): the subpage can be at user/%user/wishlist and will list user's wishlists. If the user has only one wishlist order, we can take the visitor directly there.
- Single wishlist view can be at user/%user/wishlist/%commerce_order

neograph734’s picture

The add to cart element should be altered to include a select list of user's wishlists. If the user doesn't have any wishlists, we can display a textfield instead where the user can enter the name for new wishlist.

We should perhaps also add a variable for storing the latest wishlist, so it is pre-selected when the user browses to another item. This could be the last wishlist a product was added to.

Regarding the hook_menu(): the subpage can be at user/%user/wishlist and will list user's wishlists. If the user has only one wishlist order, we can take the visitor directly there.

Yes and no. It is improved user experience, but Drupal has many pages where an "add new ..." link is shown at the top of the page. People might expect it to be at the wishlist overview page but then get redirected.

neograph734’s picture

Status: Needs work » Needs review

Committed. I've made some big changes, so I am not sure it is fully backwards compatible. And I still need to implement some proper access checks for some of the pages but let me know what you think.

  • Neograph734 committed 0bafe9b on 7.x-3.x
    git commit -m 'Issue #2485725: Allow multiple (nameable) wishlists per...
aramboyajyan’s picture

Thanks for the commit, will check it and keep you posted.

neograph734’s picture

Looking forward to your reply. Here are some things I still want to look at.

Still left to do:

  • Implement and check access control for all operations.
  • Show a textfield (or other option for creating a wishlist) on the product page, this needs to be done from the account for now.
  • Store the last used wishlist in the session and preselect this wishlist for subsequent product displays.
  • Improve lay-out of product display as the dropdown kinda breaks it. (I thought or moving the wishlist selection dropdown to a sidebar block displaying also the contents, but then we would need to split the form over multiple blocks. If the block is not present on the page fall back to a dropdown above the button.)
  • Fix the form elements on the wishlist page as they no longer work.

Future ideas:

  • Per wishlist access control like google docs; public, private or with link (we'd need some token).

  • Neograph734 committed 8f8c1c1 on 7.x-3.x
    Issue #2485725: Store wishlist name in session + show textfield if there...
neograph734’s picture

Only thing left to is access checks.

neograph734’s picture

Status: Needs review » Closed (fixed)

Closing this is favor of #2505843: Implement access checks