|
| 1 | +@using Examine |
1 | 2 | @using Umbraco.Cms.Core.Services.Navigation
|
2 | 3 | @inherits UmbracoCommerceRazorTemplateView<GiftCardReadOnly>
|
3 | 4 | @{
|
|
6 | 7 |
|
7 | 8 | // Lookup the umbraco commerce checkout page for the associated orders store
|
8 | 9 | // so that we can extract relevant settings to configure the email template
|
| 10 | + // var contentCache = this.GetRequiredService<IPublishedContentCache>(); |
| 11 | + // var nav = this.GetRequiredService<IDocumentNavigationQueryService>(); |
| 12 | + // var rootKeys = nav.TryGetRootKeys(out var keys1) ? keys1 : []; |
| 13 | + // var nodeKeys = rootKeys.SelectMany(key => nav.TryGetDescendantsKeysOfType(key, UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutPage, out var keys2) ? keys2 : []); |
| 14 | + // var checkoutPage = nodeKeys.Select(x => contentCache.GetById(x)).FirstOrDefault(x => x.GetStore()?.Id == Model.StoreId); |
| 15 | +
|
9 | 16 | var contentCache = this.GetRequiredService<IPublishedContentCache>();
|
10 |
| - var nav = this.GetRequiredService<IDocumentNavigationQueryService>(); |
11 |
| - var rootKeys = nav.TryGetRootKeys(out var keys1) ? keys1 : []; |
12 |
| - var nodeKeys = rootKeys.SelectMany(key => nav.TryGetDescendantsKeysOfType(key, UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutPage, out var keys2) ? keys2 : []); |
13 |
| - var checkoutPage = nodeKeys.Select(x => contentCache.GetById(x)).FirstOrDefault(x => x.GetStore()?.Id == Model.StoreId); |
| 17 | + var examineManager = this.GetRequiredService<IExamineManager>(); |
| 18 | + var searcher = examineManager.GetIndex("InternalIndex").Searcher; |
| 19 | + var storeNodeRecord = searcher.CreateQuery("content").Field("store", store.Id.ToString()).Execute().First(); |
| 20 | + var checkoutPageRecords = searcher.CreateQuery("content").NodeTypeAlias(UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutPage).Execute(); |
| 21 | + var checkoutPageRecord = checkoutPageRecords.First(x => x.Values["path"].StartsWith(storeNodeRecord.Values["path"])); |
| 22 | + var checkoutPage = contentCache.GetById(Guid.Parse(checkoutPageRecord.Values["__Key"])); |
14 | 23 |
|
15 | 24 | var uccStoreLogoUrl = checkoutPage.Value<IPublishedContent>("uccStoreLogo")?.Url();
|
16 | 25 | var uccStoreTsAndCsUrl = checkoutPage.Value<IPublishedContent>("uccTermsAndConditionsPage")?.Url();
|
|
0 commit comments