Copied to clipboard

Flag this post as spam?

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


  • Darren Wilson 228 posts 596 karma points
    Jun 08, 2017 @ 22:56
    Darren Wilson
    0

    Output products from Multi Product picker

    Hi Guys,

    I'm stuck with something - I'm trying to output a list of products (with images) from a Multi Product Picker on the currentPage but not having much luck. Would anyone have a wee razor snippet to help?

    This is the kind of thing i usually use...

    @{
    
      var bannerList = CurrentPage.productList.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
    
    
     var bannerCollection = Umbraco.Content(bannerList);
    
              }
             Text in here
                              }
                          }
    

    Thank you. Darren

  • Simon 692 posts 1068 karma points
    Aug 14, 2017 @ 10:08
    Simon
    0

    Hi Darren,

    How have you solved it?

    Kind Regards

  • Darren Wilson 228 posts 596 karma points
    Aug 25, 2017 @ 12:56
    Darren Wilson
    0

    I did figure it out - here's the razor:

    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
     var typedMultiNodeTreePicker = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("galleryPicker").Select(x => x as ContentModels.Gallery);                                                    foreach (var item in typedMultiNodeTreePicker)
                        {
    
                                <li>
                                   <div class="painting-caption">
    
                                        @item.PaintingTitle<br />
    
                                    </div>
    
                                    @if (item.HasValue("ShopLink"))
                                            {
                                             <div class="painting-caption1" style="right: 7px;">
                                    <a href="@item.ShopLink">
                                        Buy me
                                     </a>
                                    </div>
    
                                         }
                                      @if (item.HasValue("Painting"))
                                            {
                                            <a href="@item.Url">
                                             <img src="@item.Painting.Url" class="img-responsive">
    

    }
    

                        }
                    }
    

    I hope this helps. Darren

Please Sign in or register to post replies

Write your reply to:

Draft