I need to create a year range for my products. For example, 2006-2008. I know I can do this with product attributes.

The problem comes with search. Ideally, I would like to add this attribute to the quick search like so:

enter image description here

My question is should this be done with two fields (year_from, year_to text fields) or one (year dropdown)?

Two attributes would be easier to manage and display, but one attribute would be easier to search and likely work out of the box.

I would appreciate any guidance on how I can functionally achieve the search depicted above.


The easiest approach would be with two attributes, since not knowing a range to end with would mean pre-populating a single attribute with a range:


You can also use gteq and lteq for the filtering as well.

More Details on collections:

Alternatively you could simply set up one attribute and use a comma separated list of all possible years without the need to code anything, but would require more data entry.

Hope this helps!

  • I'll review the link. In the meantime, what about these fields as they relate to search? – Jason McCreary Jan 5 '15 at 17:15
  • As long as you have set the attribute to be used in search: Use in Quick Search & Use in Advanced Search The values of the attribute will be indexed for searches. You may consider layered navigation as well. – B00MER Jan 5 '15 at 17:59
  • I understand for the single search field and selecting all applicable years. But If I used two fields, I don't understand how the quick search would properly search for the years in between. – Jason McCreary Jan 5 '15 at 18:06
  • Okay, I read the link about collections. I understand the suggestion regarding using two fields. However, I am still unclear where would I add such code if I wanted to add a year form field to the quick search? – Jason McCreary Jan 5 '15 at 19:50
  • 1
    Thanks. I like trying to use something out of the box and as such, may go with on attribute. Thanks again for all your help. Wish I could upvote more. – Jason McCreary Jan 5 '15 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.