Vote up!
Vote down!

Using Commerce Views Display Module with Views Reference Module

I have a course product with the course date as an attribute. All the product variations are pre created, so a weekly class will have 52 variations in a year. The problem with this is I didn't want a customer to click the drop down and see all 52 class dates...I instead wanted them just to see classes up to 12 weeks out.

My solution was to use Commerce Views Display to make a view filtered by date, so only classes within the next 12 weeks would be displayed. I related that view to the product display node. In my product display node I then used a Views Reference field to pull in the Commerce Views Display view I made earlier. On node view this works perfect....the customer sees the course node and can only choose dates 12 weeks out.

So now my new problem. I want to create a view that shows all courses in Full Content format. The result is, I see all the product displays but they are missing the Add to Cart button that comes from the reference field that references my Commerce Views Display view. If I change my product display to use the normal Product Reference field instead of my Views Reference field it works....but then I got all 52 course dates showing in my option list again.

I also tried and failed at using the Field Multiple Limit module to do this. I've seemed to have run out of ideas and modules to try.

Any ideas on how to get this to work? Either by getting the views reference to show up in my All Products view, or another way to limit the number of product attributes that are displayed to a user based on date?

Thanks in advance for reading my long explanation, and any help!

Asked by: elvizzi
on December 28, 2013

1 Answer

Vote up!
Vote down!

Update: I'm using rules as a work around. A little more complex than I wanted, but it works. On every cron run I'm disabling classes that have already occured, enabling classes that are older than right now but less than 12 weeks in the future, and disabling classes that might be enabled that occur after 12 weeks. This works for now, but would be nice if there was a simple solution.

Answer by: elvizzi
Posted: Dec 28, 2013