Hi, I setup a booking system by post relationship. I have Traders and Markets, I created a relationship Booking to connect them and store the booking info in the intermediate CPT.
The set up seems to work fine but I need two more things:
1) I need to send an email notification to the Trader's author when he books a market. I don't see the notification option on Relationship forms...
2) When a user login, I show him his Trader post (each user has only one) in a View loop and the complete list of markets (a sub-View loop) with a booking button on each market. When I click the button I want to display a form with Trader and Market preselected. I found I can create this links:
[cred-relationship-form-link content_template_slug="book-a-stall" form='book-a-stall' child_item='$current']
BOOK
[/cred-relationship-form-link]
[cred-relationship-form-link content_template_slug="book-a-stall" form='book-a-stall' parent_item='[wpv-attribute name="trader"]']
BOOK
[/cred-relationship-form-link]
What I need should be this:
[cred-relationship-form-link content_template_slug="book-a-stall" form='book-a-stall' child_item='$current' parent_item='[wpv-attribute name="trader"]']
BOOK
[/cred-relationship-form-link]
But it doesn't work. How can I do it?
Is there a way to add Parent/child shortcodes on Post Forms just like in the past?
I found this, but maybe is not updated:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/
Thanks
Hi,
Q1) I need to send an email notification to the Trader's author when he books a market. I don't see the notification option on Relationship forms...
You are right, there isn't "notification" option in relationship form, it needs a feature request, our developers will evaluate it.
Q2) When I click the button I want to display a form with Trader and Market preselected
Yes, it is expected result, you can only pre-select only one side, there isn't such kind of feature to pre-select two side, same as above, it needs a feature request, our developers will evaluate it
Hi, both of them are very important features, they are things we can do with old Types and CRED versions. Isn't there a custom code workaround?
thanks
There does exist a workaround by changing post type structure, for example:
1) You can create two one-to-many relationships between:
- Trader and intermediate CPT
- Market and intermediate CPT
2) Setup a post form for creating intermediate CPT, then you will be able to pre-select it's parent Trader post and Market post, see the document you mentioned above:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/
For sending the email to "Trader" post author, you can use filter hook "cred_notification_recipients", see similar thread:
https://toolset.com/forums/topic/populate-child-post-title-with-parent-post-title/#post-908981
More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
My issue is resolved now. Thank you!
Finally I didn't need to use the filter hook "cred_notification_recipients" because I setup a common Post form with email notifications.
thanks