Skip Navigation

[Resolved] Displaying orders where customer is same as displayed post author

This thread is resolved. Here is a description of the problem and solution.

Problem:
Displaying orders where customer is same as displayed post author

Solution:

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/displaying-orders-where-customer-is-same-as-displayed-post-author/#post-1343969

Relevant Documentation:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

This support ticket is created 5 years, 2 months 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 5.77 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Chris 5 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1342801

I have a custom post type for which I have created a post template, In the post template i would like to insert a view of the orders where the customer is the same as the post author.

I have created the view to display orders with the filter set to display orders "Select posts with the author the same as the page where this View is shown."

However, this does not work. Is there a way to achieve this?

Many thanks

Chris

#1342815

I have also tried this by creating a relationship of one post to many orders and tried with the "Select posts in Any relationship that are related to the Post where this View is shown." setting for the filter

Thanks

#1342817

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I need to check with your view, how you setup and whats you passed.

As I understand, you want to display orders belongs to currently loggedin user - correct? If yes, Can you please share wp-admin access details as well as the user access details for which you wanted to display the orders.

#1342851

No that's not quite what I want.

Let me back up a bit since I am really still just sketching out possibilities.

I have a custom post type 'school profile'.

A user will register, then create a school profile, then have the option to purchase a product.

A school could have more (though is unlikely to) than one user associated with it. For one, it's easy - I use the post author but I am not sure how to connect more than one user to a post. (ie If a user joins after another user has created the school and needs to be associated with that school).

I want also to be able to link the orders to the schools. A school can have many orders associated with it.

I thought about connecting it by the customer being the same as the school author but I think maybe relationships is a better approach...not really sure.

I can create a relationship between orders and schools but I can't work out how to display that relationship on the school template. I tried inserting a view that displays orders with the filter set to "Select posts in Any relationship that are related to the Post where this View is shown."

Orders for certain products must be associated with a school. Is there a way of automatically creating the relationship when the order is created?

Just some pointers and suggestions to get me in the right direction would be great - then I can focus on specifics and get help tweaking things if needed.

Many thanks

#1343969

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

A school could have more (though is unlikely to) than one user associated with it. For one, it's easy - I use the post author
=> Ok, this is clear to you.

but I am not sure how to connect more than one user to a post. (ie If a user joins after another user has created the school and needs to be associated with that school).
=> There is no such feature, maybe you can create another post type "School Authors" and insert a new entry to this post type whenever you create a new user. And then create post-relationship between your school post type and "School Authors" post type and connet the posts.

I want also to be able to link the orders to the schools. A school can have many orders associated with it.
I thought about connecting it by the customer being the same as the school author but I think maybe relationships is a better approach...not really sure.
==> Yes, here both possibilities are possible. I suggest you may try to play with both possibility and check what best suits your needs.

I can create a relationship between orders and schools but I can't work out how to display that relationship on the school template. I tried inserting a view that displays orders with the filter set to "Select posts in Any relationship that are related to the Post where this View is shown."
=> You should try to follow the following Doc to display the related posts:
- https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

Orders for certain products must be associated with a school. Is there a way of automatically creating the relationship when the order is created?
=> You want to connect to what posts to establish relationship?

#1345281

Many thanks - that helps.

In answer to your last question. I ideally would want a relationship automatically created so that when a user buys a product the order is automatically related to a school profile (for example where the customer/user is the same as the school profile author) - is that possible?

Thanks

#1345797

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Untile I do not know how you setup your post types and how you allow your user to buy a product and what are the relationships you created I will not be able to answer this question accurately. So, it might be possible as well and not possible as well.

So, Can you please setup your order process and relationships and get back to me with all details then after reviewing your setup I would be able to guide you in the right direction.

#1347071

Many thanks I think I have this covered now as I am just linking the order and post by the author - will reopen another ticket if necessary.