Pull data from content manager conditionally

Is it possible to conditionally pull data from the content manager?

For example, let’s say I have a store that sells widgets and gadgets. On the widget product pages (dynamic pages), I want to pull data from the content manager that only belong to widgets, i.e. either pull data from any rows in my database that contains the ‘widget’ tag, or alternatively, pull all rows from a widget-only table in the database and have a 2nd table that only contains gadget rows.

And of course on the gadget product pages, I want to pull only gadget-related rows.

Thank you.

@coalpointseafoodco , if I’m understanding you correctly (and I realize you’re simplifying), you’ve got a collection that includes some rows with data for widgets and other rows with data for gadgets . The type of content in each row is indicated with a tag . On one page, you’d like to pull out and use only the widget rows. On another page, you’d like to pull out and use only the gadget rows.

If my understanding is correct, you simply need to adjust the filter in your dataset settings.

I’ve attached some screenshots from a site I’m working on right now. It’s a ‘news magazine’ site, and we have a single collection for all the articles that appear on the site. It’s a single collection, even though we have three kinds of articles: ‘Stories’, which are big pieces, ‘Voices’, which are opinion pieces, and ‘Scribbles’, which are short news pieces. Each row has a ‘type’ field which indicates which type of article is contained in that row.

That’s equivalent to your ‘gadgets’ and ‘widgets’.

My screenshot shows how I filter a dataset to collect only those article that are classified as ‘stories’. Here are the steps:

First , select the dataset and then click ’ Settings ’ from the toolbar that appears.

Second , in the Settings dialog , scroll down to the section for Filters .

Third , define your filter. In my case, I’ve set a filter on the ‘type’ field and defined it to include only those articles that have been tagged as a ‘story’.

Thank you for your reply. Maybe I’m missing something simple here but I would like to add this to dynamically-created product pages. So, if the product page is for a widget, I want to pull all widget rows, as you correctly stated. Unfortunately, the ‘Value source’ in the filter doesn’t seem to allow for a value that is pulled from any data on the product page that would help me, such as the collection the product is in. The only way I could see this working is if the ‘Value source’ in the filter could be set to “Another dataset” then checking if any of the “Collections” entries contain the tag I’m looking for. But the system won’t allow me to select “Collections”

Basically, I could use the filter if I could filter the rows based on what collection the product is in. Or if I could create a hidden field in the product that I could compare to the tags in the rows I’m pulling from.

Any thoughts?

Thank you again for your help.

Javin, if I’m now understanding you correctly, you need two datasets on the page, both based on your Product collection (this assumes you use a single collection for all your products, with a tag distinguishing widgets from gadgets).

One of the datasets is for the single item on which the page is based (a widget, let’s say). The other dataset is for all other widgets.

Presumably you’ve already got the first dataset.

Now you need the second dataset to filter based on the first dataset.

I’ve attached a screenshot from my site. In this case, I have a dynamic page for one of my articles (lets say it’s a type of ‘story’). And, on that page, I want to show a list of all other ‘stories’ (I’m not really doing this on my site, but it’s an easy way for me to illustrate.) That’s equivalent to you having a page showing a single ‘widget’, and now you want to show other widgets on that page.

My first dataset, for the single article appearing on this page, is called ‘Articles Item’.

Now I set a filter on my second dataset so it requires that the type of all the articles it chooses will have to match the type of my first dataset.

In my case, that means other ‘story’ articles. In your case, other ‘widget’ products.

Thank you so much for taking the time to help. I think the issue is that I’m using the built-in Wix store, which doesn’t seem to allow me to add custom columns in the product database. Because of this, the only element that I can actually use for the filter is the product’s ‘Ribbon’ (that I can set to ‘widget’ or ‘gadget’), but entering anything in that field ends up showing a graphic on the page that I don’t want (and prevents me from using the Ribbon for its intended purpose in the future). So, it seems, right now, I may be out of luck outside using some pure Javascript implementation or using a completely custom product page. Unless you have any other thoughts.

Thank you again for your help.

Ah, I see. Yes, I was missing the key point – you’re dealing with the built-in store. I don’t have any good ideas. Sorry.

Javin, if you didn’t come across it already in your search for a solution, you might find this interesting: https://support.wix.com/en/article/velo-tutorial-adding-a-related-products-area-to-a-wix-store-product-page

I realize that it’s not a solution for you – it requires that connections between individual products be made manually – but it does bring ‘related’ products onto the product page. I haven’t used it. I stumbled onto it just now as I was looking for possible answers, and I thought you might want to see it.

Good luck!

Thank you for the link, I will certainly use it.