products on offer on homepage

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 Jahre weitere
Hi,
there is a way to set products in offer on homepage?

Thanks
Guido
6 Jahre weitere
guidocbt wrote:
Hi,
there is a way to set products in offer on homepage?

Thanks
Guido


For default ==> You can set discount and set these products as homepage products.


You can try with this plugin too.==>https://www.nopcommerce.com/p/2190/nopexpress-category-with-products-free.aspx
6 Jahre weitere
Hi,
that plugin does not work well.
is there a way to display a certain category on the homepage via code?
6 Jahre weitere
guidocbt wrote:
Hi,
that plugin does not work well.
is there a way to display a certain category on the homepage via code?


Yes, you can  try like bellow
put the category id in the resource string, say Name ResourceByName "Homepage.Category0.Id" , you can use settings too.
===> code from nop 3.8


   [ChildActionOnly]
        public ActionResult HomepageCategoryProducts(int? productThumbPictureSize)
        {
            int categoryId = 0;
            var resource = _localizationService.GetLocaleStringResourceByName("Homepage.Category0.Id"); //put the category id in the resource string
            int.TryParse(resource != null ? resource.ResourceValue : "", out categoryId);
            if (categoryId==0)
                return Content("");
            var products = HomePageCategoryWiseProduct(_categoryService.GetAllCategoriesIdByParentCategoryId(categoryId));
            
            if (!products.Any())
                return Content("");

            //prepare model
            var model = PrepareProductOverviewModels(products, true, true, productThumbPictureSize).ToList();
            return PartialView(model);
        }


Note: same way will display how home page products works, go through how homepage product works,
If you want can use razor view without any controller action.(not recommended)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.