Skip Navigation

[Resolved] Relating two custom post types

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.

This topic contains 21 replies, has 2 voices.

Last updated by Adriano 6 years, 10 months ago.

Assigned support staff: Adriano.

Author
Posts
#151618

I created a business directory that displays local business, Each business can login and manage their listing. This is working fine.

Additionally, a business can also enter in one or more "current deals" . This is working fine.

I would like to add to my view for the business listing a way to loop around all the current deal the user entered in and display them. How can I go about connecting this current deal to a parent business listing already in the system?

Thank you very much!

Michael

#151638

Dear Michael,

Nice to see you again ­čśÇ

As I have the site access I checked that you already configured Current Deals as childreen of Business Listing, that is good. You just forgot to add the filter in the "Current Deals Shortcode" which is " Post type Current Deal is a child of Business Directory post type" (As you are using a Content Template, you need to use the second option called "Post set by parent View").

I just placed the shortcode below in the top of the Content Template, feel free to move it to where you want:

[wpv-view name="Current Deals Shortcode"]

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have..

#151675

Thank you.

I was testing on hidden link (bizdir-test user)

This user has two current deals. You can view them when you login via the side bar.

--> This is another test deal
--> biz dir test deal

While i created a separate form for current deals, was i supposed to integrate into the main biz directory form instead?

#151889

Dear Sammut,

I'm showing the current deals which is related with the current listing and not with the current user, is it what do you want?

I don't have sure if understand your question properly. Do you want to choose the business directory when you are creating the current deal?

#151970

Sorry for not being clear.

When the user adds a current deal deal i want it to attached to their business directory listing such that when the business listing is viewed I can display the current deals.

Most users will only have one listing, however some users may have two listings. So is there anyway to have a checkbox that appears with the current deal that allows the users t o select the business listing they want this attached to?

#152081

Dear Sammut,

In this case you will need to create a intermediary element to link them. There are two related documents on our site, please take a look:

https://toolset.com/documentation/user-guides/many-to-many-post-relationship/
https://toolset.com/faq/how-do-i-associate-one-child-with-several-parents-of-the-same-type/

You should use a custom taxonomy as this intermediary element. So you will add the taxonomy items on your CRED form.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

#152098

Goodness, perhaps i made this too complicated.

Question: In wp-admin if you look at the business directory area you will see I have current deals area integrated into the the parent business listing.

Is there anyway to update the CRED form form for business listings have the current deals form integrated?

#152507

Dear Sammut,

This is a Business page: hidden link

Do you want to display the childs of the current post parent? Or would you like to display all current deals to select any and update the Business post?

#152616

In it's ideal, when viewing the business listing (parent) I would like to be able to display any deal entered in for this post. So basically the user can update the parent post (business listing) and also add deals.

#152914

Dear Sammut,

I just created a View called "Deals in Business" where you can list the deals in the current business. And created a form called "Add Deal in Business", then put it in the "Business Directory (Edit)" form, you can use some CSS / Javascript to toggle it if you want.

Now you can see the Current Deals of the current Business and can add a new Current Deal. Is it what you want?

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

#152982

Thank you, i see where you are going. So my question is how do I make them display on the front end. i added a few deals but they do not show:
hidden link

#153395

Dear Sammut,

This listing (test-listing) doesn't has current deals assigned. So I added one and it is working fine "Current Test": hidden link

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

#154539

Thank you. I looked it over. I can see the one current deal listed, however, this listing has sever deals associated with it but i can only see one. When you look at the My Account page you can se the following deals that should also show. Also the "Current Test" deal you placed in does not show in the list of current deals that should show. sorry I am just just confused on why I cannot get a consistent display of deals to show on the front end and also to edit for each user.

Edit Deal added from biz page
Edit Deal added from main page
Edit test deal
Edit This is another test deal
Edit biz dir test deal

#155215

Dear Sammut,

I accessed the page of the TEST LISTING and I can see only one Deal there, the "Current Test" (take a look in the attached image). In this page you just will see Current Deals assigned to this business directory (TEST LISTING). Is it what you want to do? If not sorry for my missunderstanding.

#155217

Oh sorry, I mean on the user front end. So when you log in with the test account from the front end and you click on my account. you will see there is more than one deal that was entered via CRED form that is not displaying.