Linking CPTs together
Support › MB Relationships › Linking CPTs togetherResolved
- This topic has 1 reply, 2 voices, and was last updated 6 years, 5 months ago by
Anh Tran.
-
AuthorPosts
-
December 4, 2018 at 1:21 AM #12459
@mindspark
ParticipantHi Anh -
I've successfully set up a couple of CPTs and have the ability to link them on the backend - see here:
The goal of this website is to create records that can later be updated - think of it as a sales pipeline project - like Pipedrive or similiar.
What isn't clear to me is how to identify linked records so I can either display them or update them using Frontend Submission.
Example -
CPTs:
- Deals
- Packages
- Activities
- People (Buyers and Sellers)
Custom Field Groups:
- Deal Info
- Package Info
- Activities
The way the flow works is like this:
First Deals are created. These are preliminary records. Ideally, all deals turn into sales, but it is possible that deals never advance beyond this initial step. Deals move through many steps before they can be completed.
Second, once a Deal reaches a certain Status, then a Deal triggers a Package. The Package is a complete set of info needed for buyers to decide to purchase something. Package details are many and complex and use most of the different field types in the MB Builder.
The sales cycle can be long - so over time employees continuously work the deals/packages and update the record with Activities. All Deals/Packages will have something recorded in Activities, but some will have more than others.
In terms of Relationships - everything is One to One except for People. That's becuase people can be either a buyer or a seller and can make more than one puchase. It looks something like this:
So really I need to know:
- can CPTs be linked from the front-end? if how which form field do I use?
- after linking the CPTs together (Deals, Packages, Activities, and People) and create a complete record, how would I display a given CPT and then also all connected CPTs?
December 5, 2018 at 9:45 AM #12486Anh Tran
KeymasterHi Neil,
The MB Relationships extension automatically creates 2 meta boxes for 2 sides of each relationship with these IDs:
{$relationship_id}_relationships_from
{$relationship_id}_relationships_to
So you might need to use these IDs to include into the front-end forms to let users select a post/user to make a connection.
To display connected items in the front end, you need to code a little bit. The code is provided in the docs. As you're using Beaver Builder, I'd suggest creating a shortcode to display related items, then insert the shortcode into a text module.
-
AuthorPosts
- You must be logged in to reply to this topic.