Hi. This support request is a follow on to this one:
[Resolved] Displaying Child Posts on Parent Search Results
My client is adding Companies and Contacts to the site and it's working fine. The intermediary CPT Ownerships ties the Machines to Companies. When I do a Machine search, the view includes the Company and Ownership type but nothing shows there. I can view a Company and its owned Machines show but the Company doesn't show in the Machine listing.
The site is here:
hidden link
Select the Machine Search button and you can see all the Machines. There are Ownerships between all Machines and their associated Companies but it doesn't show on the Machine Search.
If you do a Company Search and select a Company, its Machines are listed at the bottom of the content template.
Here is the loop from my Machine Search:
<td>[wpv-woo-product-image]</td>
<td>[wpv-post-link]</td>
<td>[wpv-post-field name="_sku"]</td>
<td>[wpv-post-taxonomy type="product_cat" separator=", " format="link" show="name" order="asc"]</td>
<td>[wpv-woo-product-price]</td>
<td>[types field='pm-machine-asking-price'][/types]</td>
<td>[types field='pm-machine-size-a'][/types]</td>
<td>[types field='pm-machine-size-b'][/types]</td>
<td>[types field='pm-machine-size-c'][/types]</td>
<td>[types field='pm-machine-size-d'][/types]</td>
<td>[wpv-post-field name="company_name"]</td>
<td>[types field='pm-machine-ownership-type'][/types]</td>
What am I missing?
Thanks!
As far I recall this was as below:
Company
-- Contact
-- OwnerShip
Product
-- OwnerShip
I recall machines are products, right?
So, if you have a Custom Search for Products, and want a list of Companies as well on that page, you need to:
- create a view that queries OwnerShips (set the query to "Select posts that are a children of the current post in the loop.")
- put that View in the Machines Custom Search View
- in the View you created new (step one) in it's loop, insert a call to the Company Parent Fields
([types field='field-slug' id="$parent_post_type_slug"][/types]
Now visit the Custom Search for Machines.
You will see a list of machines (products) and the associated companies, tied through the Ownership, which is child to products and Companies.