Skip Navigation

[Gelöst] Displaying Custom Fields in Search Results in a Many to Many setup

This support ticket is created vor 6 Jahre, 9 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Beda vor 6 Jahre, 9 Monate.

Assisted by: Beda.

Author
Artikel
#550057

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!

#550248

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.