ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Searching weblog:entries by related entries?

October 07, 2010 1:03pm

Subscribe [3]
  • #1 / Oct 07, 2010 1:03pm

    Noho

    7 posts

    Hi all, this is a complicated one…

    In a site I’m working on “events” entered into the events weblog are related to “venues” which have been added to a separate venues weblog. Many events may be related to a single venue entry. I’m using 1.6.9.

    Now… I’m using dynamic parameters to help refine a listing of events weblog entries by their “venue”. Unfortunately, at the moment, it’s only returning one event when, in some cases, a particular venue may have up to ten.

    Here’s how I’m doing it:

    The form that sets the dynamic parameter:

    <select name="search:venue_test" id="search:venue_test">
    <option value="">Select Venue</option>
    {exp:weblog:entries weblog="venues"}
    {reverse_related_entries limit="1"}
    {if no_reverse_related_entries}<!-- comment out the venue name if it's got no related entries{/if}
    <option value="{venue_test}">{/reverse_related_entries}
    {venue_name}
    {reverse_related_entries limit="1"}{if no_reverse_related_entries}finish commenting out the venue name -->{/if}</option>
    {/reverse_related_entries}{/exp:weblog:entries}
    </select>

    The value returned by “{venue_test}” is a number - this field is a Relationship field. This number is passed as a dynamic parameter to the results page which displays results using this code:

    {exp:weblog:entries weblog="festival-2010-events"  orderby="date" sort="desc" dynamic_parameters="search:event_title|search:event_days|search:venue_test"}

    Like I said, the system is working (even if it’s a bit of a hack) but it’s only returning one result per venue. Is the relationship number unique to a relationship, or unique to a venue? Worded differently… is that number only valid for one relationship with the venue concerned? If so, can anyone suggest a means by which it might be possible to search weblog entries by their related articles.

    Thanks,

    John.

  • #2 / Oct 08, 2010 2:48am

    John Henry Donovan

    12339 posts

    John,

    The value returned by “{venue_test}” is a number - this field is a Relationship field.

    I think your issue here might be that only custom fields of the type “Text Input”, “Textarea”, and “Drop-down Lists” are searched with the search:field_name= parameter.

    I would try however just creating a blank template with just a weblog entry tag with the id of a venue entry hard-coded. Then try and return events via relationship tag so you can confirm it is working before heading into dynamic parameters territory.

  • #3 / Oct 11, 2010 6:31am

    Noho

    7 posts

    Hey,

    Thanks for the response. I’ve done a test, just using search:venue_test (without dynamic params) and get the same return - what’s interesting is that it finds one entry for the venue I’m looking for, but stops there.

    I suppose my original question still stands… is the number stored in the “events” entry unique to the relationship for that entry in events or common to all entries which are related to the same venue.

    I’ll keep hacking on this one and post any progress here. Any further help would be great.

    thanks,

    John.

  • #4 / Oct 11, 2010 5:00pm

    Ingmar

    29245 posts

    As John suggested, trying to get this to work without dynamic parameters first might be the way to go. Using relationships that way is certainly novel. Let me move this to the CodeShare Corner for you. Thanks.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases