Skip Navigation

[Resolved] Creating a shortlist system for members similar to airbnb – favorite system

This thread is resolved. Here is a description of the problem and solution.

Problem:
Creating a shortlist system for members similar to airbnb - build a add to favorite post using Toolset

Solution:

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/creating-a-shortlist-system-for-members-similar-to-airbnb/page/2/#post-1342931

Relevant Documentation:

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 32 replies, has 2 voices.

Last updated by Minesh 5 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1341959

Hey minesh, ahh, THAT's how you integrate the dropdown select, didn't know that 🙂

Yeah, I've tried some stuff out in a form last night.

I have deleted that form now and the JS associated with it. Is it working now?

#1341965

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check, still, If I change the option from top dropdown it fires the change event:
=> hidden link

Can you please remove all code you added for now?

#1342039

Um sure I’ll try. If you find anything, please feel free to remove it too. Its a test site so nothing can go wrong 🙂 thx.

#1342041

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

No, I do not find anything. Please make that working and I will check further.

#1342047

Ah I know whati it was. It was a code snippet. I deactivated it now. Can you please try again? Thx

#1342051

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

No luck, you can check this page and try to change the option with dropdown box, its still redirecting, you should check before get back to me after make it working: hidden link

#1342205

Hey minesh. Sorry about that. I don’t see any redirection happening, where or how can I check that?

#1342321

Okay, so I've tested your test site on Firefox, Chrome and Safari and was able to fix the redirecting by disabling the 'gestures' plugin (no problem for now, I don't need it at this moment). In Firefox it never redirected and always worked, that's why I've told you before I don't see any redirection, sorry. But in Safari: the 'select field' does not seem to work at all, it does not find any entries, I see 'not items found' in the dropdown, so there seems to be something else going on?

hope this helps you for the next step? thanks for your patience 🙂

#1342345

sorry, my bad, I was not logged in the Safari browser, so from my point of view: no redirecting happening in any browser, you should be all set for the next step 🙂 Hope this helps. Tobi

#1342887

Did you see my message? Do you need anything else from me to be able to continue? Thx for helping!!

#1342931

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following code to the form:
=> hidden link

 [cred_generic_field type='hidden' field='location_id']
{
"default":"[wpv-post-id]"
}
[/cred_generic_field]
<input type="hidden" name="shortlist_id" id="shortlist_id-[wpv-post-id]" class="shortid" value="0" />

And, following code to Forms JS box:

 jQuery('#select-shortlists').on('change', function () {
   		var selectVal = $("#select-shortlists option:selected").val();
        jQuery('.shortid').each(function(){
          $(this).val(selectVal);
        });

I've added following code to custom code section offered by Toolset:

add_action('cred_save_data', 'func_set_list_user_favorites',10,2);
function func_set_list_user_favorites($post_id, $form_data) {
    if ($form_data['id']==1205) {
      
       toolset_connect_posts('location-favourite',$_POST['location_id'], $post_id);
       toolset_connect_posts('shortlist-favourite',$_POST['shortlist_id'], $post_id);
      
$title = "fvID-".$post_id."-locID-".$_POST['location_id']."-slID-".$_POST['shortlist_id']."-uID-".get_current_user_id();
       $slug = sanitize_title($title);
         
        $args = array('ID' => $post_id, 'post_title' => $title, 'post_name' => $slug);
        wp_update_post($args);
    }
}

Now, if you go to this page:
=> hidden link
=> Click on button "Add to favorites"
=> It will add new entry here: hidden link
=> And if you edit the entry, you will notice that it will be connected to selected shortlist and related post ID

Hope this is much more info for you to proceed with your project.

#1343615

Hey minesh, WOW, thank you SO much. This is great and I’ve already managed to create a view with shortlists and link back to the original locations. Works really nicely 🙂 To finish our little shortlist system, the shortlists should now be shareable with other users.

So if you go to the ‘my account’ page: hidden link you should be able to click on one of your shortlists and then somehow choose from other users in the system that you want to share the shorltiat with and that can see the shortlist too.

So I was thinking: maybe the easiest would be to do something like this:
- when a user logs in: automatically add his name to a taxonomy list ‘users’
- in the shortlist’s content template add a post form that allows the author of the shortlist to check the user names that he wants to share the current shortlist with from the taxonomy list ‘users’
- in the shortlist view create a conditional that says: only show shortlists where the user is the author of the shortlist AND/OR the user’s name is checked in the taxonomy list

What do you think? Would that work and is this the best way to do this?

If yes, is there anything special I should look out for?

If no, what would be a better way and your suggestion?

Thanks so much, our system is almost there 🙂

#1343623

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So I was thinking: maybe the easiest would be to do something like this:
- when a user logs in: automatically add his name to a taxonomy list ‘users’
- in the shortlist’s content template add a post form that allows the author of the shortlist to check the user names that he wants to share the current shortlist with from the taxonomy list ‘users’
- in the shortlist view create a conditional that says: only show shortlists where the user is the author of the shortlist AND/OR the user’s name is checked in the taxonomy list
==> I think this is good idea. So you should create a taxonomy "shortlist users" and find a way to add user_login as term. As you already have idea, you should go with that.

This ticket lasts too long and I tried my best to help you out, please feel free to mark resolve this ticket.

#1343625

Okay, understood. Thank you. Last question before I close this: when you say: ‘find a way to add user_login’ as term’ - are you saying this is difficult and there is no standard way of doing this? Since I am not a programmer I would appreciate a hint how to do this if it is on-standard. I am closing the ticket next 🙂 thx for your input.

#1343637

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - the best way I would suggest is, find a way to setup your current WordPress users as taxonomy. You may contact any WordPress/PHP expert for this and after that, I think its pretty easy for you to setup forms and content template.