我正在为 Sitecore-uCommerce 解决方案开发语言切换,并使用默认的 uCommerce Item Resolver 和 UrlService 来获取不错的 URL。所以我有像http://sitename/catalogname/productname/c-XX/p-YY这样的 URL 。
然后对于每个站点核心“页面”项目,我使用 LinkManager.GetItemUrl(Context.Item, options) 和 LanguageEmbedding.Always 选项。
现在,如果我的 Context.Item 是一个 uCommerce 项目,那么我的 URL 是http://sitename/nl/sitecore/ucommerce/products/3/34/productname/,它不会被 uCommerce 项目解析器捕获,我将拥有找不到文档错误。
所以我需要先检查一下 Context.Item 是否是 uCommerce 项目并使用 URLService 而不是 LinkManager。
问题:在 uCommerce 中是否有类似于 Sitecore.TemplateIDs 的 TemplateIDs 类?这样我可以检查我的商品是否来自基本的 ucommerce 产品模板。
相关问题:如何在 uCommerce nice URL 中嵌入语言?
这是 HttpRequestBegin 管道
<httpRequestBegin>
<processor type="Sitecore.Pipelines.PreprocessRequest.CheckIgnoreFlag, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.EnsureServerUrl, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.StartMeasurements, Sitecore.Kernel"/>
<processor type="Sitecore.Analytics.Pipelines.HttpRequest.StartDiagnostics,Sitecore.Analytics" patch:source="Sitecore.Analytics.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.IgnoreList, Sitecore.Kernel"/>
<!--
Ensure registered bundles are ignored by http request pipeline
-->
<processor type="Sitecore.FXM.Pipelines.HttpRequest.IgnoreBundleEntries, Sitecore.FXM" patch:source="Sitecore.FXM.Bundle.config"/>
<!-- Register bundles on their first request -->
<processor type="Sitecore.FXM.Pipelines.HttpRequest.OnRequestBundleRegistrarProcessor, Sitecore.FXM" patch:source="Sitecore.FXM.Bundle.config">
<bundles hint="list:AddBundle">
<!--
The FXM client javascript bundle - see registration pipeline below. It requires the current Sitecore instance host name
when creating the bundle, so must be generated as part of a Sitecore request.
-->
<bundle>beacon</bundle>
</bundles>
</processor>
<processor type="Sitecore.Mvc.Pipelines.HttpRequest.DisplayFatalErrors, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.SiteResolver, Sitecore.Kernel"/>
<processor type="Sitecore.ItemWebApi.Pipelines.HttpRequest.SetRuntimeSettings, Sitecore.ItemWebApi" patch:source="Sitecore.ItemWebApi.config"/>
<processor type="Sitecore.ItemWebApi.Pipelines.HttpRequest.CheckMode, Sitecore.ItemWebApi" patch:source="Sitecore.ItemWebApi.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.UserResolver, Sitecore.Kernel"/>
<processor type="Sitecore.ItemWebApi.Pipelines.HttpRequest.ResolveUserFromRequest, Sitecore.ItemWebApi" patch:source="Sitecore.ItemWebApi.config"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.HttpRequest.EnableExperienceModePipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.DatabaseResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.BeginDiagnostics, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.DeviceResolver, Sitecore.Kernel"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.HttpRequest.PresetResolverPipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.HttpRequest.DevicePipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.LanguageResolver, Sitecore.Kernel"/>
<processor type="Sitecore.ItemWebApi.Pipelines.HttpRequest.ResolveLanguage, Sitecore.ItemWebApi" patch:source="Sitecore.ItemWebApi.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.CustomHandlers, Sitecore.Kernel"/>
<processor type="UCommerce.Sitecore.Pipelines.SetCurrentThreadCultureToCurrentLanguage, UCommerce.Sitecore" patch:source="Sitecore.uCommerce.Pipelines.HttpRequestBegin.config"/>
<processor type="UCommerce.Sitecore.Pipelines.BreakHttpProcessor, UCommerce.Sitecore">
<breakMatches hint="raw:AddBreakOnThisPattern" patch:source="Sitecore.uCommerce.Pipelines.HttpRequestBegin.config">
<breakMatch text="/ucommerceapi"/>
<breakMatch text="/paymentprocessor"/>
<breakMatch text="/paymentrequest"/>
<breakMatch text="/clientdependency"/>
</breakMatches>
</processor>
<processor type="UCommerce.Sitecore.Pipelines.BreakAxdExtensionProcessor, UCommerce.Sitecore" patch:source="Sitecore.uCommerce.Pipelines.HttpRequestBegin.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.FilterUrlExtensions, Sitecore.Kernel">
<param desc="Allowed extensions (comma separated)">aspx</param>
<param desc="Blocked extensions (comma separated)">*</param>
<param desc="Blocked extensions that stream files (comma separated)">css,js</param>
<param desc="Blocked extensions that do not stream files (comma separated)">*</param>
</processor>
<processor type="Sitecore.ItemWebApi.Pipelines.HttpRequest.HandleActionRequest, Sitecore.ItemWebApi" patch:source="Sitecore.ItemWebApi.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.QueryStringResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.DynamicLinkResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.AliasResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.DefaultResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.FileResolver, Sitecore.Kernel"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.HttpRequest.PreviewResolverPipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel"/>
<processor type="UCommerce.Sitecore.Pipelines.ItemResolver, UCommerce.Sitecore">
<rewriteRules hint="raw:AddRules">
<rule for="categoryProduct" match="(.*)/c-(?'productCatalog'[0-9]+)/c-(?'productCategory'[0-9]+)/p-(?'product'[0-9]+)"/>
<rule for="product" match="(.*)/c-(?'productCatalog'[0-9]+)/p-(?'product'[0-9]+)"/>
<rule for="category" match="(.*)/c-(?'productCatalog'[0-9]+)/c-(?'productCategory'[0-9]+)"/>
<rule for="catalog" match="(.*)/c-(?'productCatalog'[0-9]+)"/>
</rewriteRules>
</processor>
<processor type="Sitecore.Support.Pipelines.HttpRequest.PreviewSiteResolver, Sitecore.Support.321270.321271" patch:source="Sitecore.Support.321270.321271.config"/>
<processor type="Sitecore.Mvc.DeviceSimulator.Pipelines.HttpRequest.HandleSimulationRequest, Sitecore.Mvc.DeviceSimulator" patch:source="Sitecore.MvcSimulator.config"/>
<processor type="Sitecore.Mvc.Pipelines.HttpRequest.TransferRoutedRequest, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/>
<processor type="Sitecore.ItemWebApi.Pipelines.HttpRequest.LaunchRequest, Sitecore.ItemWebApi" patch:source="Sitecore.ItemWebApi.config"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.HttpRequest.ContextItemPipeline, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.DeviceSimulatorResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Pipelines.HttpRequest.LayoutResolver, Sitecore.Kernel"/>
<processor type="Sitecore.Mvc.Pipelines.HttpRequest.TransferMvcLayout, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/>
<processor type="Sitecore.Mvc.Pipelines.HttpRequest.TransferControllerRequest, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/>
<processor type="Sitecore.ExperienceEditor.Pipelines.HttpRequest.CheckDevice, Sitecore.ExperienceEditor" patch:source="Sitecore.ExperienceEditor.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.PageEditorHandleNoLayout, Sitecore.ExperienceEditor" patch:source="Sitecore.ExperienceEditor.config"/>
<processor type="Sitecore.ExperienceExplorer.Business.Pipelines.HttpRequest.ExecuteRequest, Sitecore.ExperienceExplorer.Business" patch:source="Sitecore.ExperienceExplorer.config"/>
<processor type="Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel"/>
<processor type="Sitecore.ContentTesting.Pipelines.HttpRequest.SetReadOnlySessionStateForScreenshot, Sitecore.ContentTesting" patch:source="Sitecore.ContentTesting.config"/>
</httpRequestBegin>