Close

Advanced Search always set to true?

petemitch
8 years ago
#9433 Quote
Avatar
  • 12
I've noticed that when Instant Search is enabled all searches get passed with the querystring adv=true which shows the advanced search options on the search results page:
http://demos.nop-templates.com/filterSearch?adv=true&cid=0&q=apple&sid=True&isc=true
Is this the intended behaviour and is there a way to switch it off? I'd prefer it not displayed by default as it takes up a lot of space.

Thanks, Pete.

Edit: I should have mentioned this happens even if I'm not using the Enable category search option.  It makes sense to have them displayed when using a category search but otherwise I'd prefer them to remain hidden. 
iliyan.tanev
8 years ago
#9439 Quote
Avatar
  • Moderator
  • 347
Hi,

Yes, you can.
Open InstantSearch.cshtml view, which you can find in Plugins\SevenSpikes.Nop.Plugins.InstantSearch\Views\InstantSearch. At the bottom of the view you will find a JS redirect looking like this:

window.location.href = "@Url.RouteUrl("HomePage")" + "search?adv=true&cid=" + selectedCategory + "&q=" + encodeURIComponent(searchedTerm) + "&[email protected]&isc=true";


Just change the parameter there.
Regards,
Iliyan Tanev
Nop-Templates Dev Team
petemitch
8 years ago
#9446 Quote
Avatar
  • 12
Cool thanks. I ended up changing the submit function to this:
$(".search-box form").submit(function(e) {
    var selectedCategory = $("#instant-search-categories").val() || 0;
    var searchedTerm = $("#small-searchterms").val();
    var showAdvancedSearch = selectedCategory == 0 ? "false" : "true";
    if (searchedTerm && searchedTerm != "") {
        window.location.href = "@Url.RouteUrl("HomePage")" + "search?adv=" + showAdvancedSearch + "&cid=" + selectedCategory + "&q=" + encodeURIComponent(searchedTerm) + "&[email protected]&isc=true";
    }
    e.preventDefault();
});

Which gives me the behaviour I wanted where the advanced search will show on the results page only if the user has selected a specific category from the search category dropdown.  Any possibility of you guys adding this to the plugin so I don't have to merge it after future upgrades?

Thanks, Pete.
iliyan.tanev
8 years ago
#9456 Quote
Avatar
  • Moderator
  • 347
Hi,

We will, but we will need to know other customers opinion on this. You should suggest this to our UserVoice portal.
Regards,
Iliyan Tanev
Nop-Templates Dev Team
ronenl
8 years ago
#11820 Quote
Avatar
  • 2
Having problem with the advanced search - which is as described always true specially when searching hebrew language.
 the encodeURIComponent translate the hebrew search term into somthing like this %u05db%u05d9%u05e1%u05d5%u05d9&
 and also gives the following error
 filterSearch?adv=false&cid=0&q=%u05db%u05d9%u05e1%u05d5%u05d9&sid=False&isc=false:170 Uncaught TypeError: 
eventhough my advanced search is set to false - it still open the advance search checkboxes and the toggleadvanced search script in search.chtml is not working.
what should I do to fix this ? 
Deni
8 years ago
#11821 Quote
Avatar
  • Moderator
  • 389
ronenl wrote:
Having problem with the advanced search - which is as described always true specially when searching hebrew language.
 the encodeURIComponent translate the hebrew search term into somthing like this %u05db%u05d9%u05e1%u05d5%u05d9&
 and also gives the following error
 filterSearch?adv=false&cid=0&q=%u05db%u05d9%u05e1%u05d5%u05d9&sid=False&isc=false:170 Uncaught TypeError: 
eventhough my advanced search is set to false - it still open the advance search checkboxes and the toggleadvanced search script in search.chtml is not working.
what should I do to fix this ? 


Hi, 

Please submit a ticket with link to your site, so we can test it and let you know what is the problem.
Best Regards,
Mladen Staykov
Nop-Templates.com
Deni
8 years ago
#11822 Quote
Avatar
  • Moderator
  • 389
Hi, 

We have just checked your site.
We have managed to see the JS error related to the URL formatting when the advanced search is on.

About the conversion of the symbols in the URL - this is a browser feature to handle specific characters.

It looks like the other things are working fine.

We will take a look at the JS error and will let you know.
I do not think it is something to worry about, because it is not breaking any part of your site.


Regards, Deni !
Best Regards,
Mladen Staykov
Nop-Templates.com
abdulwahe
6 years ago
#13955 Quote
Avatar
  • 10
I want to disable advance search option. I can not see the above code in Pavilion theme. Is this code has been replaced. The script code which I see is;


@** Copyright 2015 Seven Spikes Ltd. All rights reserved. (http://www.nop-templates.com)
    * http://www.nop-templates.com/t/licensinginfo
*@

@using Nop.Core;
@using Nop.Core.Infrastructure;
@using SevenSpikes.Nop.Plugins.InstantSearch.Models;

@model InstantSearchModel

@{
    /*
    Kendo UI specific css files.
    kendo.common.min.css - it contains common kendo styles
    kendo.default.min.css - it contains deafult kendo theme specific styles. You can use the kendo theme builder for new themes - http://demos.kendoui.com/themebuilder/index.html
    */

    Html.AddCssFileParts("~/Plugins/SevenSpikes.Nop.Plugins.InstantSearch/Themes/" + Model.Theme + "/Content/InstantSearch.css");

    var supportRtl = EngineContext.Current.Resolve<IWorkContext>().WorkingLanguage.Rtl;
    if (supportRtl)
    {
        Html.AddCssFileParts("~/Plugins/SevenSpikes.Nop.Plugins.InstantSearch/Themes/" + Model.Theme + "/Content/InstantSearch.rtl.css");
    }

    Html.AddScriptParts("~/Administration/Scripts/kendo/2014.1.318/kendo.core.min.js");
    Html.AddScriptParts("~/Administration/Scripts/kendo/2014.1.318/kendo.data.min.js");
    Html.AddScriptParts("~/Administration/Scripts/kendo/2014.1.318/kendo.popup.min.js");
    Html.AddScriptParts("~/Administration/Scripts/kendo/2014.1.318/kendo.list.min.js");
    Html.AddScriptParts("~/Administration/Scripts/kendo/2014.1.318/kendo.autocomplete.min.js");

    Html.AddScriptParts("~/Plugins/SevenSpikes.Nop.Plugins.InstantSearch/Scripts/InstantSearch.min.js");
}

@if (Model.TopLevelCategories.Count > 0)
{
    @Html.Partial("TopLevelCategoriesDropDown", @Model.TopLevelCategories)
}

<input type="hidden" class="instantSearchResourceElement"
       data-highlightFirstFoundElement="@Model.HighlightFirstFoundElementToBeSelected.ToString().ToLowerInvariant()"
       data-minKeywordLength="@Model.MinKeywordLength"
       data-instantSearchUrl="@Url.RouteUrl("InstantSearch")"
       data-homePageUrl="@Url.RouteUrl("HomePage")"
       data-searchInProductDescriptions="@Model.SearchInProductDescriptions.ToString().ToLowerInvariant()" />

@* You can change the whole html by modifying the template below without the main div element as it is used in the navigation.
    There is NO need to add anchor html elements(<a href..) as the navigation is handled automaticaly when an item is selected.
    You can use the following tokens to get the information retuned from the server:
    ${ data.ProductPageUrl } - contains the url of the product page i.e /p/7. This property is required for the navigation to work and should not be removed from the template!!!
    ${ data.ProductName } - contains the name of the product
    ${ data.DefaultPictureUrl } - contains the Url of the default product picture
    ${ data.ProductPrice } - contains the price of the product
*@
<script id="instantSearchItemTemplate" type="text/x-kendo-template">
    <div class="instant-search-item" data-url="${ data.CustomProperties.Url }">
        <div class="img-block">
            <img src="${ data.DefaultPictureModel.ImageUrl }" alt="${ data.Name }" title="${ data.Name }" style="border: none">
        </div>
        <div class="detail">
            <div class="title">${ data.Name }</div>
            @if (Model.ShowSku)
            {
                <div class="sku"># var sku = ""; if (data.CustomProperties.Sku != null) { sku = "@T("Products.Sku"): " + data.CustomProperties.Sku } # #= sku #</div>
            }
            <div class="price"># var price = ""; if (data.ProductPrice.Price) { price = data.ProductPrice.Price } # #= price #</div>          
        </div>
    </div>
</script>
abdulwahe
anton_ivanov
6 years ago
#13969 Quote
Avatar
  • Moderator
  • 277
Hello,

The code you are looking for is moved to the ~/Plugins/SevenSpikes.Nop.Plugins.InstantSearch/Scripts/InstantSearch.min.js.
Unfortunately, since the javascript is minified and not opened to our clients you cannot modify that code anymore.
The logic behind the advanced search is the following:
If you have any of the following functionalities active you will have advanced search:
- search by category
- search by manufacturer
- search by vendor
- search in product descriptions

You can disable all of them from Administration -> Nop-Templates -> Plugins -> Instant Search -> Settings by unchecking the Search in Descriptions setting and selecting "None" in the Search Option setting.

Hope that helps!
Regards,
Anton Ivanov
Nop-Templates.com
abdulwahe
6 years ago
#13971 Quote
Avatar
  • 10
I tried unchecking below mentioned options but still I see the advance search form.

1) Enable category search
2) Search in Descriptions
3) Search in product tags  
abdulwahe