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.

Combining search: and site params on MSM site

November 29, 2011 5:15am

Subscribe [5]
  • #1 / Nov 29, 2011 5:15am

    Andy Harris

    958 posts

    Hi, I’m pulling my hair out at this one. I have an MSM site with 5 sites, and I want to store all addresses on the main site but allocate them as required. To do this, I’ve created a P&T switch field for each site (display on site A, display on site B etc).

    On the main site, this works fine:

    {exp:channel:entries channel="office" disable="category_fields|member_data|pagination|trackbacks" dynamic="no" site="not gribbler" search:office_contracting="y"}
    {title}
    
    {/exp:channel:entries}

    It returns all offices assigned to the contracting site.

    If I then go to the contracting site, and call this same code via

    {embed="main_site:shared/list_offices"}

    I get nothing back at all. However, if I remove the search parameter, I get back all sites as expected.

    It’s as if the search parameter stops working when I add site - it might be worth noting that I currently also have an office channel in my contracting site. Could it be that the search parameter isn’t respecting the site parameter and searching the wrong field?

  • #2 / Nov 29, 2011 5:22am

    Andy Harris

    958 posts

    I went into my contracting site and changed its office_contracting field to xoffice_contracting - this made the code then output ALL sites, so there seems to be a problem with using site and search: together….

  • #3 / Nov 29, 2011 6:14am

    ipixel (Australia)

    158 posts

    Does this work?

    {exp:channel:entries channel="office" disable="category_fields|member_data|pagination|trackbacks" dynamic="no" site="default_site" search:office_{site_short_name}=“y”}

    Where:

    channel=“office” is the channel you’re storing the addresses in
    site=“default_site” is the short name for the ‘main’ site the addresses are located

    And the specific field name for the P&T switch matches the short name for each of your websites too for the search parameter.

  • #4 / Nov 29, 2011 6:14am

    ipixel (Australia)

    158 posts

    Maybe also double check the status=“open” on all the office entries that you have.

  • #5 / Nov 29, 2011 6:19am

    Andy Harris

    958 posts

    No, sadly not. I changed my field on the main site from office_contracting to office_[short site name] and I now get all sites back, which is the same as what happened in my second post above.

  • #6 / Nov 29, 2011 12:10pm

    Oskar Smith

    33 posts

    Unfortunately, search: doesn’t work with MSM sites.

    See:

    this thread

    (amongst many threads - you’re not alone, I’ve needed this several times before myself too)

  • #7 / Nov 29, 2011 12:21pm

    Andy Harris

    958 posts

    Ah damn it. Cheers for that - I think I’ll put in two feature requests, the first of which is to put it in the sodding documentation so I don’t waste x hours trying to get it to work!!

  • #8 / Nov 29, 2011 7:52pm

    Sean C. Smith

    3818 posts

    Andy,

    That is definitely a good feature request, sorry for the frustration.

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

ExpressionEngine News!

#eecms, #events, #releases