Global Searching in FrameMarket/MarketPress

I have a FrameMarket/GridMarket/MarketPress install.

SiteA (global) has no products.
SiteB and SiteC (sub sites) have products.

The products from SiteB and SiteC appear in SiteA as expected.

However the search function at the global site does not find any products by either their name or from text in the descriptions, etc.

It works at the sub site level for products on that site

This makes the global site search fairly useless unless there is something I am missing here.

Any ideas on how to fix this or is it a bug?

  • aecnu
    • WP Unicorn

    Greetings LANSRAD,

    Thank you for this great question and bringing this significant issue to our attention which has been discussed time and again here in the WPMU Dev forums.

    Rather then bore you with the details of intended use, that it is not a bug etc. I will get right to a possible solution for you.

    A working Global product search is possible to implement using the Global Site Search plugin using search of the custom post types "products" for the search.

    Using the Global Site Search & Market Press with the code below you should be able to display the product thumbnail instead of the product posters avatar:

    Replace line 328 of global-site-search.php with this:

    $content .= '<tr>';
    $switchblog = $post['blog_id'];
    switch_to_blog($switchblog);
    $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a href="' . $post['post_permalink'] . '">' . get_the_post_thumbnail($post['post_id'], 'thumbnail') . '</a></center></td>';
    restore_current_blog();

    Please advise if this works for getting the Global Site Search plugin picking up your products in the Global Site Search search.

    Please advise.

    Cheers, Joe

  • LANSRAD
    • Site Builder, Child of Zeus

    Thanks Joe,

    That works (once I search old posts and found to change the result types to "Products").

    So now the global site search plugin works, but the regular search in GridMarket does not.

    Is there a way to tell GridMarket to use the global site search plugin (or to replace it with that one in the header)?

    Thanks!

  • LANSRAD
    • Site Builder, Child of Zeus

    Is there a way to replace the code for the parent site ONLY?

    The setup I am going for is a parent site (the shopping cart provider if you will) and a series of shopping cart pages for different products/sites below it (via Multi-site of course.

    As such, I don't want a search initiated from any particular sub site to return results from anything other than it's own cart.

    On the parent site, I want the search to return results from any of the sub sites.

    Thanks!

  • aecnu
    • WP Unicorn

    Greetings LANSRAD,

    Thank you for the additional input and question in which they are certainly appreciated.

    Is there a way to replace the code for the parent site ONLY?

    Most would certainly say no that it would affect all sub sites.

    However, the following in an unconventional way of possibly getting this handled with just the parent site.

    Upload to your themes what will be a customized version of the Frame Market/Grid Market parent and child in a different folder name, something like Frame Market2/Grid Market2 - naming it before uploading.

    Then go into the network admin and enable the Grid Market2 child theme. Next go to the main site and activate the Grid Market2 child theme for the main site. Now go the the network admin and deactivate the theme. This will make it so it is only available to the main site.

    Customize as you desire and the second theme we created is exclusive to the main site.

    Please advise.

    Cheers, Joe

  • joshcato
    • New Recruit

    Hi Aecnu,

    Firstly, I'd like to say thank you for the great support given by yourself and your team. Even as a relative newbie to wordpress and php I have been able to figure out much of what I am trying to achieve purely through reading your solutions given to problems on this forum.

    Once again, you have delivered with this modification to global-site-search.php.

    `$content .= '<tr>';
    $switchblog = $post['blog_id'];
    switch_to_blog($switchblog);
    $content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a href="' . $post['post_permalink'] . '">' . get_the_post_thumbnail($post['post_id'], 'thumbnail') . '</a></center></td>';
    restore_current_blog();`

    I was wondering if it would be easy (or possible) to extend this by adding other elements to the global site search results. Namely, the price, a buy now / add to cart button and other product related information that customers would expect to see anywhere products are listed.

    Quite simply it would absolutely great if all product listings could appear with the same information and functionality globally, whether conducting a global search, browsing products on a sub-site, browsing categories etc.

    Thank you for your time and I look forward to your response,
    Josh

  • aecnu
    • WP Unicorn

    Greetings Josh,

    Welcome to WPMU Dev!

    Thank you so much for the compliments to the team in which I am proud to be a member of and your sincere appreciation of our skills and attempts to help others.

    I admit that though I dabble in code once in awhile, I am certainly not a coder and cannot expand on the snippet mentioned above which was actually a quick hack so to speak.

    However, I will see if our unbelievably talented WPMU Dev lead developer @Aaron would be so kind to pop in here and see if he can perhaps indeed expand some on this custom coding and snippet.

    I must inform you that custom coding is beyond the scope of the support we provide here but we do try to help if we can as you have obviously seen - provided we have the time and coding experience to do so regarding custom coding.

    As I mentioned earlier I will see if I can get our lead developer in here to possibly expand a bit on this for us asap.

    No promises or guarantees, but it will certainly not hurt to ask this busy mega talented person.

    Cheers, Joe

  • aecnu
    • WP Unicorn

    Greetings Josh,

    You are very welcome of course and I am hoping our lead developer will find the time to comment on this ticket sooner then later - but being the Chief of the developers I am certain he is knee deep in coding and it may take him a bit to make his way in here.

    Hopefully sooner then later.

    Thank you for your patience and have a GREAT upcoming weekend!

    Cheers, Joe

  • reson8
    • WPMU DEV Initiate

    Hi aecnu,

    I have the same problem but the global search did not fix it.

    I have created products in the sub sites and the main site. Products show only for the sites they were created in. Global categories show and update and show the product numbers next to them but when I click a Global category a product has been assigned to it says no products.

    I go back to the site where the product was created and the product shows when the Product category is selected?

  • reson8
    • WPMU DEV Initiate

    Hi aecnu,

    Ok I'm still struggling to get the global search functioning. I have completed the following:

    01. Setup multisite
    02. Created the parent site and a sub site
    03. Installed marketpress on both and cretaed products in both sites
    04. Installed the Global Search Plugin
    05. Installed the Post indexer Plugiin and enabled cron logging
    06. Edited the indexing on both sites to index "products"
    06. Rebuilt the index in the post indexer and two products were shown - pls see the first screenshot
    07. Perfomed a search for "camera' and "dog" boom - nothing still??

    Where do I put the code you mentioned above in the global-site-search.php? line 328 shows only a closing bracket of the code above - please see attached screenshot.

    Thanks in advance.

    Cheers,

  • hpidriver
    • The Crimson Coder

    You shouldn't need the Global Search or Post indexer Plugin if you are using FrameMarket. Under the subsite B and C Settings page you want to allow the site to be searchable. Then under main site A's FrameMarket Theme Options page there is a "What search bar do you want to use?" option and choose "Global search"

    Now your subsite products should be searchable from the main site. Hope this solves your problem.

  • Jared
    • Flash Drive

    Hey @aecnu I just wanted to note that the code you used here doesn't seem to work anymore. I found the spot to drop it in (it's something like line 388 now, but don't quote me!), but the functions seem to be outdated and you end up with "Fatal error: Cannot use object of type WP_post as array"

    I couldn't get it to work, so instead I just pull the blog name and drop it in the avatar section. But if it ever comes up again and the pulling featured image thing gets figured out, I'd love to know.

  • PC
    • WPMU DEV Initiate

    Hiya Jared,

    Its been a pretty old thread now and the theme has undergone a few changes too.

    I will really appreciate if you could please create a new thread so that we can take care of it accordingly.

    Cheers
    PC
    Sales &Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.