Skip Navigation

[Résolu] Filter and database question

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

Last updated by willem-siebeS Il y a 8 années et 2 mois.

Assigned support staff: emerson.

Auteur
Publications
#135630

Hi,

I'm working on a price comparison website for a niche website. I use a filter for this where I can import feeds and thus the products.
This is all being stored in my database right now. Can I extract/use this info to make the comparison website with TVC toolset?

For the rest I have a question about the filters that are being used here: hidden link.
I have read a lot about faceted search, but because it's al in english sometimes it is difficult.
However, reading about e-commerce it looks like normal practise (and woocommerce works like that), that you make some categories for your products, and when people have chosen a category, than filters will be visible.

So lets say I choose for category 1, then I am on this page: site.com/category1/.
Normal behaviour if you apply filters (for example filter on brand): site.com/category1/brand%5B%5D=studio3

So, on the canonical URL, the filter is being applied. On the page with URL site.com/category1/brand%5B%5D=studio3 a canonical link element is included in the head to the page with all the products of category1.

The advantage of this cananical link element is that people can still link to my URL + filter on it, and Google will pass the link juice to my category page (which I want to be indexed in Google ofcourse).

So, my problem with the Bootcommerce filter example, when somebody applies a filter it goes straight to a 'search-results' page. Can I have it the way described above. Because I don't want a search page, I just want to narrow down the results of a certain category with filters being applied on that URL.

When people search in a search box then I find it oke to have a search-results page ofcourse, but not with narrowing down the content.

Kind regards,

Willem

#135636

I think I was to fast, because the parametric search parameters are used on an page I can choose myself.
So I think I can make more parametric search views with the correct parameters and apply them on different pages :-).

#135646

Ok, on my discover site I made a parametric search form, with the widget I can select a target page.
However, when I want to insert the parametric search from in a page, as explained here: https://toolset.com/documentation/user-guides/front-page-filters/#tutorial
I can NOT select a target page. What am I missing here?

Kind regards,

Willem
PS Discovery site is hidden link

#136018

Dear Willem,
Thanks for your sharing the URL of your discover-wp test site. I will take a look at your site and study your case. I will give you my detailed thoughts on this tomorrow.

Cheers,
Emerson

#136400
none.jpg

Dear Willem,
I'm able to login at your discover-wp site example. I see that you have created some Views for filtering but you cannot set the target page right? Basically when you are creating Views search filter. You need to add that View to a page that displays the results. For example, in your site it is the "Search Results" page that contains this View that displays the filtered parametric results:

[php]
[wpv-view name="Search Filter"]
[/php]

If you don't add this View to a page that displays the results, it will be displayed as "none" when you are trying to add that form such as in the screenshot. It will show a message "No target page were found that use this View.". You need to insert that View to any existing page first and then add the form shortcode.

Please let me know if you have something else to clarify. Thanks.

Cheers,
Emerson

#138947

Hi Emerson,

OK, so: if I use the widget to display the filters, I can set a target page without having to include the shortcode view in that specific page?
Because that seems to work, I have a filter widget with targetpage 'Women', but on that page there is no shortcode like this one: [wpv-view name="Search Filter Women"].

If that is correct what I say, I understand your explenation like this: If I want to show filters IN a page, I only can set a target page for that filter-form if the shortcode [wpv-view name="Search Filter Women"] is included on that page.

I hope the above is correct, one more question regarding to this, it is no problem to have all these 3 shortcodes on one page?

[wpv-view name="Women"]
[wpv-view name="Search Filter Women"]
[wpv-form-view name="Search Filter Women" target_id="129"]

Kind regards,

Willem

#138948

Ow, and I wonder if I can extract data from the database like I asked in my first question here. This data is saved to the same database as WordPress but use other prefix.

#139120

Dear Willem,
Thanks for the feedback. About your inquiry:
***OK, so: if I use the widget to display the filters, I can set a target page without having to include the shortcode view in that specific page?
Because that seems to work, I have a filter widget with targetpage 'Women', but on that page there is no shortcode like this one: [wpv-view name="Search Filter Women"]."

----------> The widget you have added is a Views filter form called "Search Filter Women". I checked at you have set the target page to "Women". But inside Women page: hidden link is a View "Women" that is configured to return results based
based on this query: "Select posts with taxonomy: Gender is One of these (Women)".That's why when you clicked on it, the results will simply show all posts belonging to the Women taxonomy. You can find the "Women" View here: hidden link. The correct way is that the target page should display results based on URL arguments. The "Women" view is not configured to do that, even though you observed it returning results.

No, you cannot set a target page without having to include a Views shortcode in that target page that actually displays the posts based on URL arguments. It will return either return blank or return wrong results.

***"it is no problem to have all these 3 shortcodes on one page?

[php]
[wpv-view name="Women"]
[wpv-view name="Search Filter Women"]
[wpv-form-view name="Search Filter Women" target_id="129"]"
[/php]

----------> Well that depends on the purpose of your Views. Its not good that have any of these shortcodes if one shortcode just duplicates the functionality of another. You need to test to see if it fits. The usual practice of parametric search is done in two ways;

a.) First method: Put the VIews shortcode (which is configured to show parametric form and show results) in that same page and displays the results in the same page. This only requires only one View shortcode to show the form and show the results.

b.) Second method: Use the Parametric search form and specific a target_id, e.g.
[php][wpv-form-view name="Parametric Test" target_id="10"][/php]
And put the View that is configured to display these parametric results in another page (matching the target_id).

This implementation requires two separate Views shortcode: one for the form and one for showing the results sent from the form (retrieved using URL arguments). In your example:
[php]
[wpv-form-view name="Search Filter Women" target_id="129"]
[/php]
is already a form. If you want to use that shortcode in that page, then you don't need the other two shortcoes if any of them would also display the form. You should put the target page on another page, not on the same page.

***"Ow, and I wonder if I can extract data from the database like I asked in my first question here. This data is saved to the same database as WordPress but use other prefix."

------------> Views by default is not designed to handle that, it requires custom coding to let Views communicate to the database. There is no filter available at this time; so I cannot suggest you sample code using an API. For details, you can contact our Toolset Custom Development Services: hidden link if you like to have your apps custom coded.

Please let me know how it goes. Thanks.

Cheers,
Emerson

#139283

Hi Emerson, thanks for your lenghty explenation. I totally understand now what I was doing wrong, I didn't understand the 'concept' completely, but thanks to your explenation I do. I didn't try it to do it the right way, but I'm 99,99% sure I will have no problems with it anymore.