1

As the title describe, I want my product has a date attribute(ex. the date this product begin in stock).

And I can filter the products using this attribute's year. For example, if there are 2 products in 2013-09-08 & 2014-10-10, the filter will show two options 2013 and 2014.

Currently I think I can create another attribute to save the year data, but I'm not sure how to set this attribute not show when I create a new product and how do I write in the value when I save this product.

Is there any better solutions?

Bruce Chen
  • 123
  • 4

1 Answers1

0

You need to set year as a drop down attribute with the setting use in layered navigation set to yes.

Paras Sood
  • 2,540
  • 1
  • 14
  • 23
  • I knew this but according to this way there will be two attributes: publish date & publish year. Can I let the admin just enter the date once? – Bruce Chen Sep 03 '14 at 07:16
  • publish date wouldn't be type drop down but publish year needs to be a drop down for it to be included in layered navigation. It might just be cleaner to have separate fields for the two.

    Edit: You could write an observer for before save of the product through admin and in that select the publish year attribute for the admin without them having to do it.

    – Paras Sood Sep 03 '14 at 07:21
  • Hi I have using observer and it looks work now, thanks! – Bruce Chen Sep 04 '14 at 06:25