Tell us what you are trying to do?
I'm assuming this is probably outside the scope of your support and I'll need to hard code this myself, but I was hoping you'd be able to tell me whether or not I'm heading in the right direction?
I have a post type item-model which has two children types (accessory and request-line).
What I want to do, is each time a form is submitted for request-line, I would like to query accessories for all posts that have the same item-model parent and automatically create a new request-line for each related accessory, automatically filling each request-line post with data from each accessory post.
My assumption is that I would need to use the cred_before_save_data hook, and then query accessories, and for each accessory fill in the data into a new request-line and then save the new request-line post to the database.
Does this sounds like I'm heading in the right direction? There wouldn't be an easier way to do this within Toolset, without having to resort to PHP would there?
I've just had another thought on this.
Instead of automatically adding the new request-lines, I actually want the user to accept those additions, and have the opportunity to edit or delete them before they are saved.
So I think what I actually want to do is something like when someone adds a request-line that includes a parent item-model which has accessories, then it should display a view of those accessories, saying something like 'We notice you have chosen to add [item-model]. Most people who choose to rent that item also usually rent the following:'
Then it should display a view of the accessories linked to that item-model, but as a CRED form for request-lines if that makes sense. So for each accessory child of the same parent item-model, I wish to display a CRED edit form for a request-line that is autofilled with default values taken from accessory, which the user can then edit or delete.
I think I'm going to try this on my own and I'll come back to support with a more specific query if I get stuck.