Jump to content

Search the Community

Showing results for tags 'search filter structure'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. Hi guys So I'm building a little search index for a client with this recipe I've found on the ProcessWire Recipes website (more info: https://processwire-recipes.com/recipes/set-up-search-index-with-fieldtypecache/) I've followed the exact steps in the recipe and the script appears to be working, except for Profields: Repeater Matrix. 🙄 This is the code I've got so far: <?php include('includes/header.php') ?> <?php $q = $sanitizer->selectorValue($input->get->q); if($q) { $results = $pages->find('search_cache%='. $q); } else { $results = new stdClass(); $results->count = 0; } ?> <section class="partners-block-consul mb-5"> <div class="container"> <div class="row"> <div class="col-sm-10 offset-sm-1"> <div class="partners-head sec-p-lg"> <?php if($page->headline) { ?> <h1 class="highlight"><?= $page->headline ?></h1> <?php } ?> <div class="cms text-left"> <p>Er werden <?= $results->count ?> resultaten gevonden.</p> <?php if($results->count > 0){ ?> <ul> <?php foreach($results as $result){ if($result->template->name == "faq_item") { $category = $pages->get("id=".$result->faq_category); $parent_template = $category->rootParent(); ?> <li><?= $result->title ?> - <a href="<?= $parent_template->url . $category->name . "/"; ?>" title="<?= $result->title ?>"><?= $labels->read_more ?></a></li> <?php } elseif($result->template->name == "faq_category") { $parent_template = $result->rootParent(); $faqCategoryUrl = $parent_template->url . $result->name . "/"; ?> <li><?= $result->title ?> - <a href="<?= $faqCategoryUrl; ?>" title="<?= $result->title ?>"><?= $labels->read_more ?></a></li> <?php } else { ?> <li><?= $result->title ?> - <a href="<?= $result->url; ?>" title="<?= $result->title ?>"><?= $labels->read_more ?></a></li> <?php } ?> <?php } ?> </ul> <?php } ?> </div> </div> </div> </div> </div> </section> <?php include('includes/cta.php'); ?> <?php include('includes/footer.php'); ?> In the ProcessWire admin the "search_cache" field is being build as follows (see image 1). Then, the field 'search_cache' is being used on the following templates (see image 2 and 3). So, let's say I'm searching the word 'kinderen', which should get a hit on the template 'Kind', the script isn't returning this page as one of the hits (the result should return 'migraine'). If someone has any idea why the script is not looking for the data that is being put in the field "Profields: Repeater Matrix", he/ she would be my personal hero! 🤗 Greetings Cédric
  2. Hi I'm quite new to processwire but I already fall in love with it. But now I'm struggeling with a problem for more than a week, since I'm not very good at PHP programing, but am willing to learn. I want to make a real estate page and I want to focus on the search capabilities of processwire. I made a structure Real estates (template=realestates) - Country 1 (template=country) - Region 1 (template=region) - Product 1 (template=realestate-input) - Region 2 - Product 2 - Country 2 - Region 3 - Product 3 - Country 3 Hidden Options - Rooms ( to use as page field in template=realestate-input) - 1 room - 1,5 room - ... - Type ( to use as page field in template=realestate-input) - Appartement - House - Holiday house I've looked at skyscrapper search examples but I can't crack it to fit in my case. I've made a form which generates Country's and Region's: <form id='skyscraper_search' method='get' action='<?php echo $config->urls->root?>iskanje/'> <h3>Real estates</h3> <p> <label for='search_keywords'>Keywords</label> <input type='text' name='keywords' id='search_keywords' value='<?php if($input->whitelist->keywords) echo $sanitizer->entities($input->whitelist->keywords); ?>' /> </p> <p> <label for='search_Location'>Location</label> <select id='search_Location' name='location'> <option value=''>Vse</option><?php // generate the location options, checking the whitelist to see if any are already selected foreach ($pages->get("/nepremicnine/")->children() as $country) { $selected = $country->name == $input->whitelist->location ? " selected='selected' " : ''; echo "<option$selected value='{$country->name}'>{$country->title}</option>"; foreach ($country->children() as $Location) { $selected = $Location->name == $input->whitelist->location ? " selected='selected' " : ''; echo "<option$selected value='{$country->name}/{$Location->name}'> - {$Location->title}</option>"; } } ?> </select> </p> <p><input type='submit' id='search_submit' name='submit' value='Search' /></p> </form> On click I want to make selector look for template=realestates-input on selected parent of upper form. The following code works for regions, becouse their childrens are "realestate-inputs", but if I select country I want to display all realestates in every region. <?php // most of the code in this template file is here to build this selector string // it will contain the search query that gets sent to $skyscraperList $selector1 = ''; // we use this to store the info that generates the summary of what was searched for // the summary will appear above the search results $summary = array( "location" => "", ); $location = $input->get->location; echo "<br>" . $location . "<br><br>"; // if a location is specified, then we limit the results to having that location as their parent if($input->get->location) { //$location = $pages->get("/realestates/" . $sanitizer->pageName($input->get->location)); $location = $pages->get("/realestates/{$input->get->location}"); if($location->id) { $selector1 = "parent=$location, "; $summary["location"] = $location->title; $input->whitelist('location', $location->name); } } //$selector1 .= "template=realestates-input, "; $matches = $pages->find("$selector1,"); echo "<br>Found: " . count($matches) . " match<br>"; echo $selector1; foreach ($matches as $match) { echo "<br>" . $match->title; } When I'll crack this one I will only need to filter the search results based on selected options on realestates-input template. But also don't know how to make a selector for that. I would really appriciate any guidance to complete my task. Thank you
×
×
  • Create New...