Images not shown in custom widget - Ecommerce - Ecommerce - Progress Community

Images not shown in custom widget

 Ecommerce

Images not shown in custom widget

  • Images not shown in custom widget
  • I created an image slider (jquery) which should slide through my product images. I use the following code:

    protected void Page_Load(object sender, EventArgs e)
     
                if (!IsPostBack)
                    rptProductSlider.ItemDataBound += new RepeaterItemEventHandler(rptProductSlider_ItemDataBound);
                    BindData();
                
            
     
            void rptProductSlider_ItemDataBound(object sender, RepeaterItemEventArgs e)
     
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     
                    Product p = e.Item.DataItem as Product;
                     
                    var imgProduct = e.Item.FindControl("imgProduct") as Image;
                    imgProduct.ImageUrl = p.ThumbnailUrl;
                    imgProduct.AlternateText = p.ThumbnailAlternativeText;
                
            
     
            private void BindData()
                 
                var manager = CatalogManager.GetManager();
                this.rptProductSlider.DataSource = manager.GetProducts();
                this.rptProductSlider.DataBind();
            

    For some reason the slider shows the default image instead of the image that I uploaded with my products.
    /SFRes/images/Telerik.Sitefinity.Resources/Images.DefaultProductTmb.png

    What am I doing wrong? The ProductList control that comes with the ECommerce module, is showing the images without a problem?

    Regards,
    Daniel
  • Hi Daniel,

    You'll need to call CatalogManager's "PopulateImages" function on the list of Products that are returned from "GetProducts". Alternatively, you can call "SetProductImages" on each Product returned from "GetProducts".

    Regards,
    Tom
  • Can't figure out what 'provider' I have to fill in with this method. The SetProductImages() works okay, though...
  • Passing an empty string for that parameter will be fine in most cases.
  • Hm... doesn't work, unfortunately.
  • 296655_ProductsWithImages.zip
    Hi Daniel Plomp,

    The solution that Daniel suggested will work. I am also providing you a small sample attached to this reply where I demonstrated how you would get list of Products with Images.

    Let me know if you are still facing any issues, and I will be glad to help.

    Kind regards,
    Venkata Koppaka
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>