Wix Store Products Dynamic Dataset Filter by Collection

I have a basic wix store. It uses the Products and Collections store tables. I am trying to figure out how to filter a dynamic dataset to include only products that belong to a collection. The collection is provided as a query string, so it should be loaded dynamically. The products and collections are many-to-many.

Example: If I want my dataset to be populated with all “clearance” products, the url would look like /collection/clearance, and the product dataset would contain only products tagged with the clearance collection; of /collection/fuzzy would show only products that were in the fuzzy collection.

There seems to be no relational data in these pre-built tables.

Thanks!

3 Likes

Hi Bryan,

You can use setFilter() function.
Add an onReady() function to the dataset and inside the handler add the setFilter() function.

$w.onReady(function () {
 $w("#dataset").onReady(() => {
    $w("#dataset").setFilter(wixData.filter()
       .eq("the field name", "The collection name (the string)")
       .then(() => ( })
    });
});

If there is a problem, please send us a URL to your site and specify the name of the page.
Which page is the one that lead to the page that you wish to present the products there?

Best,
Sapir

Thank you for the reply. Unless I’m missing something, that will not work. Again, I am using the standard, built-in products and collections tables. If I look at the database tables, there is no relational information that I can find between the two. The products do not seem to have a “collection” field that I can set the filter on. Each product can belong to many collections, each collection can have many products in it. If I export the product list, it does have a collection column with a semi-colon separated list in it. However, this column does not appear in the table

1 Like

Hi,

I understand what you’re trying to achieve and instead of writing your own code ( what will make it more complicated for you) I suggest you to use this wix store built in feature:

Best,
Sapir

It would be great if I could use the product gallery and dynamically change which collection it displays. However, this seems to be left out of it’s abilities for some reason. It is not practical to have users search for one of the many collections defined in these filter settings to display what I want. I’m sure this works great for stores with just a few items in them, but we have lots of products, and a large number of collections.

What I am trying to achieve is having one page that can display any product collection I send to it. Customers should be able to click on links for a certain collection, or use the search function to find products. I want only one products page to that I have to maintain, instead of 50. If I decide to change the style of one product collection page at the moment, all the others still use the old style until they are manually edited one by one. This is not practical or maintainable especially since the store will continue to grow.

Searching and displaying only products from a single category is critical. It is amazing to me that these features are not part of the wix store. How often do you go to Amazon.com or Ebay.com, or any other online retailer without using the search function? My guess is very rarely if not never.

My product display page should be able to take in a category, and an optional search parameter. Wix seems to go out of their way to make this difficult. The optimum solution would be to be able to use the product grid gallery, and dynamically change which category is displayed. This seems like it should be a simple function for it. On top of that, setting a search filter would be fantastic. However, since it cannot do these things, I need to create a separate page to do so.

4 Likes

Hello @bryanvagis ,

I am looking for the exact same functionality you asked here, and was wondering if you have found any workaround in the end to prevent building separate pages for each collection?

Thank you beforehand!

cc @sapirh @sapirham

1 Like

Hi Gaspar,

Unfortunately I never did find an acceptable solution. This seems like a huge feature missing from the framework. It would appear that the relation between the two tables was purposely hidden. I’m not sure why.

I ended up creating a dynamic page that didn’t filter by category for search results, and separate pages for each of the categories my client wanted to display. So now there are about 30 product pages that are all exactly the same, but just display a different category. I didn’t have time in the budget to keep messing with it.

This is likely not what you want to hear, but I couldn’t come up with a better solution without some major re-work.

Cheers!
Bryan

2 Likes

Hello Bryan,

Thank you very much for your detailed and super fast response! I appreciate it very much.

Exactly what I didn’t want to hear, but what I was expecting… It is really a missing feature and feels that should be adapted to the dynamic pages thing.

Let’s see if we can get it anytime soon.

Thanks again!
Gaspar

#feature #request

2 Likes

Hi @Bryan Vagis, I am looking for the exact same functionality which you described and also wondering if you did any work around for this? It’s crazy to think how you would have to change x number of product pages for little edit and to think how many more you are going to do. Like for your instance if you made 50 edits, that end up being 2,500 edits you would have to do…:slight_smile: I think you are right to the fact that they are purposely hiding this functionality, but I don’t understand why. But how else can they display collection sets on the store grids? And how does it display all the different products in the different collections in the store products page if they are not already linked together. I just don’t understand why you would hide this. I was going to create a separate table to link the two together. Then will have to create some process to re link the two each time I do an import of products.

There could be some functionality that is not there yet for other dynamic stuff to work.

1 Like

I wish I had better news to tell you guys, but the best solution I came up with is not a good one. The details are explained in my previous post.

The long term result of this will be my avoidance of using Wix for clients who want eCommerce websites. They have a good platform, but the lack of basic, expected functionality is a deal breaker.

Cheers!
Bryan

1 Like

Hi @Bryan Vagis and @gasparmelsion , I think I figured out a solution possibly with the standard store setup. Let me know if you would like to discuss . You can contact me at tomjohnson@johnsonsflorists.com . It maybe to long of discussion for here. I thought maybe we could collaborate there and then post later if everything looks good.
Tom

1 Like

i have the same problem,

i’m wondering to have a one shopping page , with the horizontal menu bar contain links to each collections, then products gallery/repeater underneath which will change based on the collection selected in the horizontal menu bar, so that visitor don’t need to change the collections display with filter.

and instead of “LOAD MORE” button, it will good if it has a numbered page underneath the products gallery.

also when i have a different amount of products in collections, and i change the filter from “most product” collections to “less products” collection, the distance of the page to footer didn’t update, which make a huge blank space between product gallery and the footer.

Hope wix will make an update, which answers much feature-requests that have so much votes already, so that wix will not only good and easy for making a landing page but also good and easy for making an ecommerce websites, or even any type of website.

Wix allow to add product dataset filter is ‘collections’ reference field, but can’t connect it to a dropdown list. I don’t understand Wix :frowning: This is a basic function, at least in products searching :frowning:

3 Likes

I am looking for the exact same function and it is very frustrating that Wix does not provide it. I need the filter to connect til a dropdown list.

1 Like

Any Comment from a Moderator. This thread is still unresolved and not sure why this functionality exists on all wixdata, but not on wixdata from wix stores?

1 Like

I was able to filter a Stores/Products dataset by Collection to display products in a repeater on a dynamic page I created. But in order for it to work, I had to add TWO datasets: One for Products and one for Collections. Then cross filter them.


Everyone’s situation is different. But hope this helps.

3 Likes

This is because if you look at the Wix Stores app Product collection, then you will see that the collections field is a reference field and can only be filtered through code with the hasSome query function.
https://support.wix.com/en/article/corvid-wix-stores-product-collection-fields#collections-collections

Collections (collections)

Description : The collections the product belongs to.
Type : Reference (Multiple Items)
Can connect to data : No
Can use in dynamic page URL : No
Can be sorted : No
Can be filtered : hasSome
Read-only : Yes

To understand more about using and displaying reference fields, then that is already well explained in the Wix Support pages.
https://support.wix.com/en/article/about-reference-fields-in-database-collections
https://support.wix.com/en/article/field-type-support-and-limitations-in-the-data-manager
https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-reference-fields-4034931
https://support.wix.com/en/article/working-with-multiple-item-reference-fields
https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-reference-fields

2 Likes

Hi Ash4Dzyns

I have tried to add a second dataset that connects to the first dataset. However, when I go to preview mode to open the dropdown list, the dropdown list does not work. It won’t allow me to open the list. Do you know what the problem could be? It seems that the dropdown list is inactive.

My page is a dynamic item page and I would like users to be able to filter by category e.g. pool, room etc. by using a dropdown list. Hope that you can help.

@lanluu82 Hi! Your HotelSouthEast dataset, is that your Dynamic page’s default dataset? I should clarify. I am also working from a Dynamic Item page. And in total I actually have THREE datasets:

  1. My Dynamic Page Dataset - the default one created when I set up the Dynamic Item page, connected to a Database Collection (Which I named: Accessories_Products, in this case)

  2. Then I added a 2nd Dataset which I connected to the Stores/Products collection

  3. Then I added a 3rd Dataset which I connected to the Stores/Collections collection.

It is these last 2 datasets that need to be filtered.

A 4th important step I also hadn’t mentioned: In my Dynamic Item pages database collection I added a reference field for Stores’ Collections:

The default Stores/Collections database that comes with the basic Wix Stores setup typically only has two columns: 1. Name & 2. Main Media. But, now when I revisit my Stores - Collections database there is a new reference field for Accessories_Products.

Now, I can go back to my Dynamic Item page for this Accessories_Products database collection. But now I set up the filters for the Stores/Products dataset and the Stores/Collections dataset as I showed in my previous comment:

Finally, I can connect my repeater. And I connect it to the Stores/Products dataset:


Only now, when I hit preview, the repeater will display store products filtered by store collection based on the Dynamic Item page displayed.

Again, not sure your full scenario @Lana. And @givemeawhisky is correct about the API below. But in my scenario I was able to filter a dataset by Stores/Collections on a Dynamic Item page without any code.

1 Like

@fordcreatv Wow… Thank you so much for your thorough explanantion. I am not a pro-wix user, so I take baby steps to figure things out.

“HotelSouthEast dataset, is that your Dynamic page’s default dataset”. Yes it is. I will try again with your new explanation.

Is your store published? Can I see how filtering works on your store?

1 Like