Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Not having any success getting both fields to work in concert in a contextual filter. I've tried adding both fields into the same filter and also attempted creating 2 separate filters for each field.
I can get each field working correctly by itself but doing a combination of the two fails. Any ideas?
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedYou need them to be in the same filter. I have no idea what you mean by 'not having success'. You will have to provide a lot more information for me to have any idea what you have done and what you thought would happen and what did happen.
Comment #2
cossovich CreditAttribution: cossovich commentedI have a content type with 2 date fields:
If I only use one of the date fields in the contextual filter for the calendar view, the content is displayed in the calendar correctly. If I add both date fields into the contextual filter, no content is displayed.
Comment #3
KarenS CreditAttribution: KarenS commentedSounds like you have them set up with 'AND' and you should change them to use 'OR'. You can control that if you add both of them to the same filter. If you set them up as separate filters they will always use 'AND' and you will only see items where both dates match the criteria.
Comment #5
skyredwangI have exact the same problem as #2, and have used 'OR' as the operator; but no content display.
I use the generated query from Views, and dump it into mysql, the result is not null.
The tested version was head on Aug.24th
Comment #6
skyredwangalso received this warning
Comment #7
seddonym CreditAttribution: seddonym commentedTested dev today, same problem here with two date fields on different content types.
Comment #8
ilovetoast CreditAttribution: ilovetoast commentedI am experiencing the same problem. I am using both dev's up to date.
I have two different date fields in different content types. Works fine with one date. I have tried every-combination of and/or, adding separate contextual filter and both dates in one filter. Cleared the cache a lot, No luck. I received no error, the month display just has no content in it.
Comment #9
cossovich CreditAttribution: cossovich commented@skyredwang I was also using the 'OR' operator when I posted my comment in #2... I eventually gave up on pursuing this particular view and went back to a single date field. I didn't have time to look into the date_views code but I suspect have two date fields with such different configuration as the arguments isn't supported.
Comment #10
David D CreditAttribution: David D commentedI'm also running into this problem (same as #8). I'm using 7.x-3.x-dev (2011-Sep-06). With my Contextual Filters set to "Date: Date (node) (Content: Meeting Date & Time (field_meetdate) OR Content: Show date(s) - start date (field_show))", I get nothing. Deselecting either of the fields in the contextual filter will restore the display of the other event.
Comment #11
David D CreditAttribution: David D commentedDarn! I just noticed that I unintentionally created a new revision of the Issue Summary here when I commented previously. I did the same thing just now in another issue here. I don't know what I'm doing to cause this!
EDIT
Nevermind. I see this happens to everyone.
Comment #12
ccurwen CreditAttribution: ccurwen commentedsubscribe
Comment #13
chemicalroman CreditAttribution: chemicalroman commentedsubscribe
Comment #14
dps_addesign CreditAttribution: dps_addesign commentedAlso trying to set up a calendar view with 2 contextual filters for two node types with different "date" fields. One has "end date", the other doesn't.
These errors show up:
Notice: Undefined property: stdClass::$field_date in calendar_plugin_row_node->render() (line 291 of /sites/all/modules/calendar/includes/calendar_plugin_row_node.inc).
Warning: array_key_exists() expects parameter 2 to be array, null given in calendar_plugin_row_node->render() (line 306 of /sites/all/modules/calendar/includes/calendar_plugin_row_node.inc).
Warning: Invalid argument supplied for foreach() in calendar_plugin_style->render() (line 280 of
/sites/all/modules/calendar/includes/calendar_plugin_style.inc).
Comment #15
amir_razavi CreditAttribution: amir_razavi commentedsuffer the same problem!
Comment #16
amcc CreditAttribution: amcc commentedif i have more than one type of date selected in the contextual filter i get the following errors. I have the latest devs of calendar, date and views
Comment #17
amir_razavi CreditAttribution: amir_razavi commentedI am wondering what has happened with this issue! At the moment I am using "Full Calendar" (because it supports more than one date field for the calendar)! But if this issue solves, I would like to use this module!
Comment #18
KarenS CreditAttribution: KarenS commentedI cannot replicate any problem using two different date fields in the same contextual filter. If I join them using OR, any fields that meet either criteria show up in the view.
There must be something else in the view besides that one thing. Or else the problems have been since fixed in later versions of the code.
Get the very latest development versions of both Date and Calendar and clear all your caches. Also edit and re-save your view. If you still have problems you can reopen, but I need more information about exactly how the fields are configured and how the view is set up.
Comment #19
KarenS CreditAttribution: KarenS commentedI was thrown off track by the reports of error messages. I see no error messages in the latest code but I do see that the dates are not getting displayed in the calendar. So that is still an issue and I can replicate it.
Comment #20
KarenS CreditAttribution: KarenS commentedOK, I found the problem, some bad logic that returned if the value was missing instead of continuing to process the other fields.
http://drupalcode.org/project/calendar.git/commit/f6ca42b
Comment #22
Canadaka CreditAttribution: Canadaka commentedI'm still not able to show nodes that use different date fields on the same calendar. I get no errors but only 1 of the node/field types show. I have OR selected in the contextual settings. I tried the commit above but the RC1 version is much newer.
Comment #23
lupuz CreditAttribution: lupuz commentedI'm still having problems with multiple date fields in contextual filters.
In mini-calendar, when it first loads, the events show fine. But when use the pager to show the next month only first day of the month is highlighted with an event (also when that day don't have one).
I've seen that when events are loaded (in calendar_plugin_row::pre_render()) the $values array is not the events from the next month, they are from current. As a result, the array to be rendered have only 1 item $array[2012-MM-01][00:00:00] with all the events inside.
Comment #24
lupuz CreditAttribution: lupuz commentedSeems to be solved with last Date API update.