Only show RelatedProducts when necessary

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Im trying to figure out how to show a certain html block when certain conditions are true.
However i get the following error:

Compiler Error Message: CS1061: 'Nop.Web.Models.Catalog.ProductDetailsModel' does not contain a definition for 'RelatedProducts' and no extension method 'RelatedProducts' accepting a first argument of type 'Nop.Web.Models.Catalog.ProductDetailsModel' could be found (are you missing a using directive or an assembly reference?)


  @if (Model.RelatedProducts.Count > 0)
  {
    <div class="combinations">
      <div class="wrapper">
        <h2>Combinations</h2>
        @Html.Action("RelatedProducts", "Product", new { productId = Model.Id })
      </div>
    </div>
  }


Above code is placed in ProductTemplate.Simple.html (and it is working without the if statement only then it will show the title even if there are no products.
6 years ago
Already figured it out.
I placed the title in the RelatedProducts.cshtml template.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.