Displaying Manufacturers Thumb Images

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
Hello,

I would like to be able to display manufacturers thumb images on the home page in the manufacturers side navigation box.

Thanks
14 years ago
In addition to the Manufacturer names, or in place of them?
14 years ago
In place of them of the names. I think i am in right in saying that you can give a manufacurers a image but it never gets used.
14 years ago
Correct. You would need to create a new Manufacturer template for them to show up on a list page.

As for showing them in the Manufacturer's list, that's definitely not user-configurable either. Would require custom coding.
14 years ago
How would i go about doing this then.
14 years ago
After messing around with trying to recompile the code (simply things huh) i have a solution.

the solution removes the hyperlink and replaces it with the manufacturers thumb image

step 1.

change the manufacturernavigation.ascx to have the following the following places the manufacturers images into two lists. you can un-comment the hyperlink to add back in the manufactueres text. make sure that the new hyperlink has the name hlImageLink as this is refered to in the code later.

        <asp:Repeater ID="rptrManufacturers" runat="server" OnItemDataBound="rptrManufacturers_ItemDataBound">
            <HeaderTemplate>
                <ul>
            </HeaderTemplate>

            <AlternatingItemTemplate>
                
                    <asp:HyperLink ID="hlImageLink" runat="server" />&nbsp;&nbsp;    
                </li>      
            </AlternatingItemTemplate>            
            
            <ItemTemplate>                
                
                   <%-- <asp:HyperLink ID="hlManufacturer" runat="server" Text='<%#Server.HtmlEncode(Eval("Name").ToString()) %>'
                        CssClass='<%# ((int)Eval("ManufacturerID") == this.ManufacturerID) ? "active" : "inactive" %>' />
                    --%>
                  <li>
                    <asp:HyperLink ID="hlImageLink" runat="server" />    

                
            </ItemTemplate>
                        
            <FooterTemplate>
                </ul>
            </FooterTemplate>
        </asp:Repeater>

step2.

in manufacturersnavigation.ascx.cs file replace the function rptrManufacturers_ItemDataBound with the following:
this is what assigns the control its image and properties. again uncomment the code to add back in the hyperlink text.


        protected void rptrManufacturers_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Manufacturer manufacturer = e.Item.DataItem as Manufacturer;
                HyperLink hlImageLink = e.Item.FindControl("hlImageLink") as HyperLink;
                if (hlImageLink != null)
                {
                    hlImageLink.ImageUrl = PictureManager.GetPictureUrl(manufacturer.PictureID, SettingManager.GetSettingValueInteger("Media.Manufacturer.ThumbnailImageSize", 125), true);
                    hlImageLink.NavigateUrl = SEOHelper.GetManufacturerURL(manufacturer); ;
                    hlImageLink.ToolTip = manufacturer.Name;
                    hlImageLink.Text = manufacturer.Name;
                }


                              
                //HyperLink hlManufacturer = e.Item.FindControl("hlManufacturer") as HyperLink;
                //if (hlManufacturer != null)
                //{
                //    hlManufacturer.NavigateUrl = SEOHelper.GetManufacturerURL(manufacturer);                    
                //}
            }
        }

Hope this helps someone

and once you done this you have to recompile the solution.

an example of this will be up in the next couple of days at www.fishon-online.com
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.