Skip Navigation

[Résolu] Perametric Search – Listing all of the possible entries multiple times

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 5 réponses, has 2 voix.

Last updated by Adriano Il y a 7 années et 6 mois.

Assigned support staff: Adriano.

Auteur
Publications
#217951

Hi

I have created a view to list fields from parent and child posts. To do this, I have created a child view and inserted it to the parent view and it is working fine:

Parent field 1
Parent field 2
Child Title 1
Child Title 2
Child Title 3
…..
I created a parametric search for this view by filtering with two other parent fields (let’s call call them parent field 3 and parent field 4). The layout section of the parametric view is something like this:

<wpv-loop>
[wpv-view name="merchant-view-for-all-coupons-page-with-coupons-view"]
</wpv-loop>

Unfortunately, when I click on the search button, it does list all possible entries for the number of correct results. For example if there are supposed to be two results that matches the filters, it list all of the possible results twice.

How can I list the correct results only once? I would appreciate your help on this?

Thanks

#217974

Dear James,

I need to understand it better to reproduce on my localhost, can you provide access to your site? The private area is enabled, please fill the fields if you can.

#218209
merchantviewforallcouponspahewithcouponview.gif
couponviewforallcouponspage.gif
Parametricsearchviewforallcoupons.jpg
parametricsearchpage.jpg
All Coupons Page.png

Hi Adriano

I am testing the website in a local environment, so I am unable to provide access to the website. However, I am going to try to give you as much information as I can so you may be able to what I am doing wrong.

I am working on a coupon website for tourists, visiting my home country Turkey. Eventually and hopefully, it will be a website where local small business in Turkey can post their discount coupons and visitors can search and print coupon.

In this instance, I am working with two CPTs: Merchant (parent) and Coupon (Child).

Previously I have created a view just to list all of the coupons available. To do that I have created a view for child CPT and added it to the Merchant view for Merchant CPT. (couponviewforallcouponspage.jpg and merchantviewforallcouponspahewithcouponview.jpg)

This is working fine and I am happy with it (see All Coupons Page.png)

I am trying the create a search page where the results are listed the same way as the All Coupons Page.

I have created parametric search view and used the same view of the All Coupons Page in the HTML Layout section. (Parametricsearchviewforallcoupons.jpg)

However, when I search I lists all results a few times.( parametricsearchpage.jpg)

Thanks

#218232

Dear James,

Thanks for this complete explanation, very useful indeed.

The way you are doing it is wrong. If you call the "Merchant View for All Coupons..." inside of the wpv-loop, it will print all results of this view for each loop item, it doesn't matter search parameters.

First of all you need to know you will list coupons items, so you must use custom fields to this post type in the Filter section.

Then you should create the layout of the view following this one - "merchantviewforallcouponspahewithcouponview", but you can not use the coupon view inside of it. So you can highlight the title of the parent post (Merchant) and should use the ID argument to get the value of the parent post like:

[wpv-post-title id="$merchant"]

Then to show the value of coupon, you shouldn't use the ID argument:

[wpv-post-link]

It will print the link of the coupon, in according the search.

The result of it should be something like that:

Merchant 1
Coupon1

Merchant 1
Coupon2

Merchant 2
Coupon1

Merchant 2
Coupon2

I'm afraid for now it is not possible to group by parent posts.

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

#219389

Thanks

#219419

You are welcome.