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?
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
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.
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.
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.
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?
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?
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.