I have taken over the editing of a site that has been developed with Toolset and I need to expand the functionality of the current content. This is the current demo site link: hidden link
A custom post type was previously setup for 'businesses', with custom contact fields, that are displayed as a kind of categorised directory across the site. My client now wants to add a 'products' section to the site, which will display a product image, company details and an external link to the product on the businesses own website. This product section will likely need to be categorised, much like the business section. So customers can dial down to a specific type of product, such as 'Coffee' for example.
As the products are all going to be linked to a business that already exists on the site, what is the best way of linking this content rather than filling out all the business details again?
Can I create a new CPT for 'products' and then somehow have a dropdown on the post edit admin page that allows me to assign an existing business CPT to them, so I can load in the relevant business contact details into the 'product' single post template on the frontend? I've read that you can have post relationships, but cannot work out how I can manually assign one to the other.
Alternatively, I was thinking of adding product fields to the existing 'business' posts, but there may be multiple products for each business, so can you create a repeating group of custom fields, like you can with a single field? So when you wanted to add a new product, one click creates a new set of fields for product image / title / weblink?
Thanks in advance.
As the products are all going to be linked to a business that already exists on the site, what is the best way of linking this content rather than filling out all the business details again?
Hi, you could use a Repeatable Field Group inside the Business post type to represent each Product. Or, you could use a custom post type Product in a relationship with the custom post type Business. The main difference here is that Repeatable Field Groups (RFGs) do not generally have their own single post page on the front-end of the site. So if you want to be able to have a single post page for each Product, RFG is not the best solution.
Can I create a new CPT for 'products' and then somehow have a dropdown on the post edit admin page that allows me to assign an existing business CPT to them, so I can load in the relevant business contact details into the 'product' single post template on the frontend?
Basically yes, this is how post relationships work. First, you set up the relationship in Toolset > Relationships. Then you can see in the single post editor an interface for creating a new related post, or linking to an existing post. See post-relationship-manager.png. In this case I am connecting Books and Chapters, and trying to find an existing Chapter to connect to the current Book.
Alternatively, I was thinking of adding product fields to the existing 'business' posts, but there may be multiple products for each business, so can you create a repeating group of custom fields, like you can with a single field?
This is how RFGs work, in general. But please see the information above to understand when it is better to use RFGs and when it is better to use a custom post type and a post relationship.
Thanks Christian, the one to many post relationship works a treat. I created new posts for the products and enabled them to be linked to the business posts via this relationship. Many thanks.