Show matching items from other collection

Hi,

I have two CMS collections, let’s call them ‘Collection A’ and ‘Collection B’ with basically the same fields.

On the template page of Collection A I want to show products/items from Collection B that match a certain type of CMS field input, per example; UPC. So basically it’s like this: Show items from Collection B if they have the same UPC number as current Collection A product.

Because I’m using CSV import I don’t want to add another CMS collection with just the ‘UPC’ so I can filter by reference field.

I hope this is possible in any way. Thanks in advance!

Hey @Giel88

From the top of my head, without using a third collection there are two options I can see.

  • Use a separate collection list for each of the matches and do a “name equals _____” filter
  • Some javascript to write your own custom filter
1 Like

Hey @matthewpmunger,

Thanks you for your response and idea’s :slight_smile:

  • Use a separate collection list for each of the matches and do a “name equals _____” filter
    I have to many different matches, in total 100 items with 50 different CPU codes imported from a CSV, and these changing.
    So creating a collection list for every match is too much of a hassle.
  • Some javascript to write your own custom filter
    Sadly Im not really skilled in javascript. Is there a guide about custom collection filtering somewhere that shows me in the right direction?

Thanks once again :smiley:

@Giel88

That’s what I was afraid of. So yeah using lists is out. I’m also not a javascript coder, but I did just think of another option.

When importing to a collection via CSV you can map a column to an Option Field.

Option field - any column can be mapped to the option field. All unique values in this column will become the options for this field (with a maximum of 100 options).

This would fit your requirements and not require any extra work or custom code. Then use a conditional on the lists to match current Option field. Does that make sense?

Thanks you for your help @matthewpmunger, it is very much appreciated!

Sadly I’m unable to map any row of the CSV to the option field. The option field is greyed out. Do you know if there are any restrictions on the type of content you can map to the option field?

Hey @Giel88, it should be fine as long as you are under 100 options (as you stated around 50). Maybe recheck that university article to see if there are any other conditions or limitations that might be the issue. If you still can’t figure it out, contact support@webflow.com to see if they can help you further.

Hope you can solve it.

1 Like

Yeah, It was probably due to the fact that I have more than a 100 items in the CSV. So I tried it with less items but with the option field you’re still unable to match items between 2 collections.

For now I’ll just let this rest or read into javascript a bit unless someone else has an idea. Maybe the upcoming e-commerce will have a solution for this.

Thanks once again. :slight_smile:

I’m having the same issue as Giel88. I’m importing a CSV to a Blog Posts collection, with a column for “Category” to say which Category the post belongs to. For example: “Life” or “News” or “Gear”. However, when I try to map the Category column from the CSV to the Category field on import, Category field is grayed out and I’m not allowed to select it. Category is a Reference to a webflow collection called “Category” that just lists out the categories allowed. Thoughts?