Inhalte aufrufen

Profilbild
- - - - -

Not show title in new section


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
2 Antworten zu diesem Thema

#1 hanoinews

hanoinews

    Newbie

  • Members
  • Punkt
  • 3 Beiträge

Geschrieben: 15 June 2019 - 03:02

Hi everybody
I am currently experiencing an error while writing a new section on the homepage, when I delete the temporary files in the Temp directory, the title is displayed but when I stop and start  website on iis, the title is not displayed. Or I also add an attribute for ProductSummaryModel ex  Title and delete all file in the folder Temp ASP.Net website  run fine but when in debug in visual studio but title not display. Can someone help me? Sorry my bad english.Thanks
Code in controller
//[ChildActionOnly]
		public ActionResult HomepageProductsByCategoryId(int? productThumbPictureSize, int categoryId, string title)
		{
			var products = _productService.GetAllProductsDisplayedOnHomePageByCategory(categoryId);

			// ACL and store mapping
			products = products.Where(p => _aclService.Authorize(p) && _storeMappingService.Authorize(p)).ToList();

			var viewMode = _catalogSettings.UseSmallProductBoxOnHomePage ? ProductSummaryViewMode.Mini : ProductSummaryViewMode.Grid;

			var settings = _helper.GetBestFitProductSummaryMappingSettings(viewMode, x =>
			{
				x.ThumbnailSize = productThumbPictureSize;
			});

			var model = _helper.MapProductSummaryModel(products, settings);
			model.GridColumnSpan = GridColumnSpan.Max6Cols;
            model.Title = title;
            ViewBag.Title = title;  
			return PartialView(model);
		}

Code in view

@model ProductSummaryModel
@using SmartStore.Web.Models.Catalog;

@{ 
    if (Model.PagedList.TotalCount == 0)
    {
        return;
    }
    var Title = ViewBag.Title; //Model.Title;
}

<div class="product-grid product-grid-home-page block">
	<div class="heading heading-center">
		<h3 class="heading-title fs-h1">@Title</h3>
	</div>

	<div class="block-body pt-3 artlist-no-separators">
		@{ 
			Html.RenderPartial("Product.List", Model);
		}
	</div>
</div>

Code in Index.cshtml

 Html.RenderAction("HomepageProductsByCategoryId", "Catalog", new { categoryId =1, title="Hot Promotion"});

 



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 17 June 2019 - 11:12

You can use ProductSummaryModel.CustomProperties instead of ViewBag to inject new properties into the view model.... and I would use ChildActionOnly attribute here. The rest sounds weird to me, maybe just a local dev issue.

Marcus Gesing

Smartstore AG


#3 hanoinews

hanoinews

    Newbie

  • Members
  • Punkt
  • 3 Beiträge

Geschrieben: 18 June 2019 - 07:32

Thank for reply
I found reason, SmartStore.Web.dll in folder Temp and bin  are diffirence (date modified), dll in Temp folder still older date. i don't known why. I try close, clean, build and rebuild but not change. if copy dll in bin to Temp folder, website run ok. Can you tell me how about fix it?