Exemplo n.º 1
0
 public ActionResult SearchBox()
 {
     var model = new SearchBoxModel()
     {
         AutoCompleteEnabled = _catalogSettings.ProductSearchAutoCompleteEnabled,
         ShowProductImagesInSearchAutoComplete = _catalogSettings.ShowProductImagesInSearchAutoComplete,
         SearchTermMinimumLength = _catalogSettings.ProductSearchTermMinimumLength
     };
     return PartialView(model);
 }
Exemplo n.º 2
0
        public ActionResult SearchByCatgory()
        {


            string categoryCacheKey = string.Format(ModelCacheEventConsumer.CATEGORY_MENU_MODEL_KEY,
                        _workContext.WorkingLanguage.Id,
                        string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
                        _storeContext.CurrentStore.Id);

            var cachedCategoriesModel = _cacheManager.Get(categoryCacheKey, () => PrepareCategorySimpleModels(0));

            List<CategoryModel> CheckList = new List<CategoryModel>();

            foreach (var data in cachedCategoriesModel)
            {
                CategoryModel custom = new CategoryModel();
                custom.Id = data.Id;
                custom.Name = data.Name;
                custom.SeName = data.SeName;
                custom.Description = data.Description;
                custom.MetaDescription = data.MetaDescription;

                custom.SubCategories = data.SubCategories.Select(x => new Nop.Web.Models.Catalog.CategoryModel.SubCategoryModel
                {
                    Name = x.Name,
                    SeName = x.SeName,
                    PictureModel = CustomPictureModelDetail(x.Id, x.Name)
                }).ToList();

                custom.PictureModel = CustomPictureModelDetail(data.Id, data.Name);
                CheckList.Add(custom);
            }

            SearchBoxModel Searching = new SearchBoxModel();

            Searching.AutoCompleteEnabled = _catalogSettings.ProductSearchAutoCompleteEnabled;
            Searching.ShowProductImagesInSearchAutoComplete = _catalogSettings.ShowProductImagesInSearchAutoComplete;
            Searching.SearchTermMinimumLength = _catalogSettings.ProductSearchTermMinimumLength;
            ViewBag.HomePageCatgoryList = CheckList.ToList();

            return PartialView(Searching);
        }