Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
This may be a silly question, but I can't figure it out. How do i get all products and not the featured products? How should the foreach statement look like? While still using the models builder ofc.
@using ContentModels = Umbraco.Web.PublishedContentModels;
Layout = "Master.cshtml";
@if (Model.Content.FeaturedProducts != null)
foreach (Product product in Model.Content.FeaturedProducts)
<a href="@product.Url" class="product-grid__item" style="background-image: url('@product.Photos.FirstOrDefault().Url')">
<div class="product-grid__item__price">@Model.Content.DefaultCurrency @product.Price.ToString("F")</div>
Assuming this is your products page and all your products sit below it as children with no other types of document you could use this:
foreach(Product product in Model.Content.Children().Select(p => new Product (p)))
Models Builder only know's the properties that belong to that specific piece of content. You have to perform additional logic away from the Model or adjust the model to match your needs.
Hope this helps,
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted