Skip Navigation

[Resolved] Post relationships and alternate post layout display

This support ticket is created 6 years 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.

Our next available supporter will start replying to tickets in about 8.88 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Author
Posts
#631642

Hi,

I'm having a few challenges finsihing off my application and hoping your expertise can help me overcome these hurdles.

My data model (Custom Types) is structured as follows:

Order 1:M Order Person
Order Person M:1 Person

I use Order Person to deal with the M:M problem.

When I create a new order I basically set the Order ID into a session variable so that I can auto-populate the CRED form value that appears as a drop down on the new Order Person page. I also store the person ID postid too into the session. This works fine.

The flow for a new order is as follows:

Create an Order
Loop
Create Person (using basic Post Form)
Create Order Person (pre-populate Person and Order fom Session using custom form function to pre-set values)
Finish and View Order
Complete Order

I have now a few challenges:

1. I only want to send notifications when the user has confirmed the Order is ready for submission. I was thinking the order can be draft until they confirm. How can I implement this please?
2. I have created a layout for viewing the Order however I have another layout to display the full order i.e. every field of every Type linked to the order. How can I show an alternate view of the order please?
3. I need to be able to amend the Order and add a new Person and link them to the order by creating a new Order Person record. I can't seem to get the forms to pick up the order they are linked to. have tried using a parentid as well as trying to hook in somewhere and set the sessionid of the order currently being viewed. Please can you advise?

Many thanks in advance. These are the final things to get live.

Cheers,
Si

#631771

Dear Si,

Q1) Please elaborate the questions with more details:
How do you setup the post type "Order"? With Types plugin or Woocommerce plugin?
How do you define the "user has confirmed the Order", is it a custom field?

I need detail steps to duplicate same problem, test it in my localhost, thanks

Q2) You can display the same post in different layouts, for example the post URL is:
hidden link

You can setup the URL parameter "layout_id" to the layout's ID, for example:
hidden link

It will be able to use layout 123 to display the post "test-1"

Q3) Are you using many-to-many relationship between post type "Order" and "Person", if the post type "Order Person" is the intermediate post type , you can setup a CRED form for editing the "Order Person" post, there you can change it's parent "Order" post and parent "Person" post

#634294

Q1) Please elaborate the questions with more details:
How do you setup the post type "Order"? With Types plugin or Woocommerce plugin?
[Me] Yes the types plugin.

How do you define the "user has confirmed the Order", is it a custom field?
[Me] I don't currently. The order is created as published. I'd prefer draft then confirm later to publish and then send notifications.

I need detail steps to duplicate same problem, test it in my localhost, thanks

Q2) You can display the same post in different layouts, for example the post URL is:
hidden link

You can setup the URL parameter "layout_id" to the layout's ID, for example:
hidden link

It will be able to use layout 123 to display the post "test-1"

[Me] This works great, many thanks.

Q3) Are you using many-to-many relationship between post type "Order" and "Person", if the post type "Order Person" is the intermediate post type , you can setup a CRED form for editing the "Order Person" post, there you can change it's parent "Order" post and parent "Person" post

[Me] Yes, I am using it as the intermiediate or joining post to link order and person however it also holds a few extra fields itself and therefore has its own post form too. What I really need is the ability to know for which Order I cam currently looking at and then it to be automatically chosen in the drop down. So, the flow is as follows:

Customer says I need to add a new person to Order xyz.
User will find the order in the system and then choose to add Person to order.
They enter basic details about the person and submit.
- This creates a new Person record.
They then enter details about the persons role in the order.
- This is the order person record and has a drop down for person and for order. Neither are set and I'd like them both to be preselected since I started at the order and I have just created a person. Normally you can use session variables or wondering whether some cookie + javascript could help here.
They submit and are redirected back to the order which now shows the additional party.

Hopefully this helps clarify.

#637803

Q1) It depends on yourself, you can try with post status or post field, both should be able to work, see our document:
https://toolset.com/documentation/user-guides/automated-email-notifications-with-cred/
section "Send the notification when submitting the form"
screenshot:
hidden link

Q3) One CRED form can create/edit only one post, so if your CRED form is creating/editing child "Order Person" post, it can not create new "Person" post in the same time, there isn't the built-in feature within CRED form.

I suggest you ask your Customer to create the "Person" first(It needs another CRED form), then show them the CRED form for creating/editing child "Order Person" post, there they can select the existed "Person" fields. see our document:
CRED Forms for Child Content
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.