Thumbnails for Recently Viewed Block

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anni tempo fa
There has got to be an easier way to show thumbnails in the recently viewed BLOCK (not the page)
It wasn't an issue setting that up in the previous web forms versions, but it appears a bit more complicated in MVC.
12 anni tempo fa
You need to edit this action or ideally create a new one from a plugin:

[ChildActionOnly]
        public ActionResult RecentlyViewedProductsBlock()
        {
            var model = new List<ProductModel>();
            if (_catalogSettings.RecentlyViewedProductsEnabled)
            {
                var products = _recentlyViewedProductsService.GetRecentlyViewedProducts(_catalogSettings.RecentlyViewedProductsNumber);
                foreach (var product in products)
                    model.Add(PrepareProductOverviewModel(product, false, false));
            }
            return PartialView(model);
        }


This because of the PrepareProductOverviewModel which passes false for the preparePictureModel parameter. In other words even if in the RecentlyViewedProductsBlock.cshtml view you add razor code to show the picture from the ProductModel, it won't work because the picture would not be in the model. So you need edit the action to pass true for the preparePictureModel parameter. Or better create a plugin and have a CatalogController in it with a RecentlyViewedProductsBlock action.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.