當前位置: 首頁>>代碼示例>>C#>>正文


C# Category.GetCategoryBreadCrumb方法代碼示例

本文整理匯總了C#中Nop.Core.Domain.Catalog.Category.GetCategoryBreadCrumb方法的典型用法代碼示例。如果您正苦於以下問題:C# Category.GetCategoryBreadCrumb方法的具體用法?C# Category.GetCategoryBreadCrumb怎麽用?C# Category.GetCategoryBreadCrumb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nop.Core.Domain.Catalog.Category的用法示例。


在下文中一共展示了Category.GetCategoryBreadCrumb方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Category


//.........這裏部分代碼省略.........
            //TODO:  insert *estimate* in here for filtering?
            model.PagingFilteringContext.PriceRangeFilter.LoadPriceRangeFilters(category.PriceRanges, _webHelper, _priceFormatter);
            var selectedPriceRange = model.PagingFilteringContext.PriceRangeFilter.GetSelectedPriceRange(_webHelper, category.PriceRanges);
            decimal? minPriceConverted = null;
            decimal? maxPriceConverted = null;
            if (selectedPriceRange != null)
            {
                if (selectedPriceRange.From.HasValue)
                    minPriceConverted = _currencyService.ConvertToPrimaryStoreCurrency(selectedPriceRange.From.Value, _workContext.WorkingCurrency);

                if (selectedPriceRange.To.HasValue)
                    maxPriceConverted = _currencyService.ConvertToPrimaryStoreCurrency(selectedPriceRange.To.Value, _workContext.WorkingCurrency);
            }


            //*******************************************************************************************************************
            //* The category breadcrumb s/b ok because it looks at the hierarchy above the current node, which is stable 
            //* regardless if a lot is associated
            //**************************************************************************************************************
            //category breadcrumb
            if (_catalogSettings.CategoryBreadcrumbEnabled)
            {
                model.DisplayCategoryBreadcrumb = true;

                string breadcrumbCacheKey = string.Format(ModelCacheEventConsumer.CATEGORY_BREADCRUMB_KEY,
                    categoryId,
                    string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
                    _storeContext.CurrentStore.Id,
                    _workContext.WorkingLanguage.Id);

                //%%%get the breadcrumb here
                model.CategoryBreadcrumb = _cacheManager.Get(breadcrumbCacheKey, () =>
                    category
                    .GetCategoryBreadCrumb(_categoryService, _aclService, _storeMappingService)
                    .Select(catBr => new AUCategoryModel
                    {
                        Id = catBr.Id,
                        SaleId = inSaleId,
                        Name = catBr.GetLocalized(x => x.Name),
                        SeName = catBr.GetSeName()
                    })
                    .ToList()
                );
            }




            //*******************************************************************************************************************
            //* Subcategories need modification because you only want to show subs that have a lot associated for this sale if sale provided
            //* this will affect what shows in the main panel when you click the parent node, and also affects child categores passed in the url to 
            //* this action from the breadcrumb and navigator
            //**************************************************************************************************************
            //TODO deteermine if store wants to manage categories by sale. if so, use special stored procedure, otherwise use standard nop
            //logic to show raw category tree. use temporary variable for interim to control flow

            if (manageCategoriesBySale)
            {
                string subCategoriesCacheKey = string.Format(AUModelCacheEventConsumer.SALE_CATEGORY_SUBCATEGORIES_KEY,
                    inSaleId,
                    categoryId,
                    string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
                    _storeContext.CurrentStore.Id,
                    _workContext.WorkingLanguage.Id,
                    _webHelper.IsCurrentConnectionSecured());
開發者ID:HumanSystems,項目名稱:nopcommerce-dev,代碼行數:66,代碼來源:AUPublicController.cs


注:本文中的Nop.Core.Domain.Catalog.Category.GetCategoryBreadCrumb方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。