-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: backport plugin to nopCommerce 420
- Loading branch information
Showing
6 changed files
with
22 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 3 additions & 23 deletions
26
Nixtus.Plugin.Widgets.Lucene/Infrastructure/RouterProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,15 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Routing; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Nop.Core.Domain.Localization; | ||
using Nop.Data; | ||
using Nop.Services.Localization; | ||
using Microsoft.AspNetCore.Routing; | ||
using Nop.Web.Framework.Mvc.Routing; | ||
using System.Linq; | ||
|
||
namespace Nixtus.Plugin.Widgets.Lucene.Infrastructure | ||
{ | ||
public class RouterProvider : IRouteProvider | ||
{ | ||
public int Priority => 1; | ||
|
||
public void RegisterRoutes(IEndpointRouteBuilder endpointRouteBuilder) | ||
public void RegisterRoutes(IRouteBuilder endpointRouteBuilder) | ||
{ | ||
var pattern = string.Empty; | ||
if (DataSettingsManager.DatabaseIsInstalled) | ||
{ | ||
var localizationSettings = endpointRouteBuilder.ServiceProvider.GetRequiredService<LocalizationSettings>(); | ||
if (localizationSettings.SeoFriendlyUrlsForLanguagesEnabled) | ||
{ | ||
var langservice = endpointRouteBuilder.ServiceProvider.GetRequiredService<ILanguageService>(); | ||
var languages = langservice.GetAllLanguages().ToList(); | ||
pattern = "{language:lang=" + languages.FirstOrDefault().UniqueSeoCode + "}/"; | ||
} | ||
} | ||
|
||
// override autocomplete search | ||
endpointRouteBuilder.MapControllerRoute("ProductSearchAutoComplete", $"{pattern}catalog/searchtermautocomplete", | ||
new { controller = "LuceneCatalog", action = "SearchTermAutoComplete" }); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters