Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amir Khan 1199 posts 2567 karma points
    Nov 28, 2012 @ 22:18
    Amir Khan
    0

    Multi-node Tree Picker Media

    Hi,

    I'm having some issues getting an image from a multi-node tree picker stored as CSV, I get an error with this code but can not seem to figure out why. Am I missing something simple? It works as expected without the foreach loop related to the image...

    @using umbraco.MacroEngines
    @using uWebshop.RazorExtensions
    @inherits DynamicNodeContext


    @if (Model.HasValue("mustHaves"))
    {
    string[] ids = Model.mustHaves.Split(',');

    <ul>
    @foreach (string id in ids)
    {
    var product = Library.NodeById(id);
    if (product.Id != 0)
    {

    <li>
    <a href="@Navigation.GetLocalizedUrl(product.Id)">

    @foreach (var image in @product.Images)
    {
    var imageNode = @Model.MediaById(image.Id);

    <img src="@imageNode.umbracoFile" alt="@imageNode.altText" width="175" height="220"/>

    }


    </a>
    <div class="productDetails">
    <h2>@product.Title</h2>
    <span class="price">Price:$ @product.PriceWithoutVat</span>
    <a href="@Navigation.GetLocalizedUrl(product.Id)" title="@product.Title" class="btn">View Details</a>
    </div>
    </li>

    }
    }
    </ul>
    }
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies