Simple Category List Images

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
User avatar
Cornerstone
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Nov 12, 2008 10:34 am

Simple Category List Images

Post by Cornerstone » Mon Dec 15, 2008 9:09 am

Is there a way to have images instead of text links for the categories?

I attempted this making all the image the same as the text of the "Name" of the category...

<asp:HyperLink ID="CategoryLink" runat="server" ImageUrl="images/<%#Eval("Name")%>.jpg" NavigateUrl="<%#Eval("NavigateUrl")%>"></asp:HyperLink>

instead of this...

<asp:HyperLink ID="CategoryLink" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#Eval("NavigateUrl")%>'></asp:HyperLink>

and this will not work. I get an error. I don't know ASP.Net very well and would appriciate any help. Thanks!

Derek

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Simple Category List Images

Post by mazhar » Mon Dec 15, 2008 9:19 am

It sounds like a path problem. You have to provide more information for image location like

Code: Select all

<asp:HyperLink ID="CategoryLink" runat="server" ImageUrl="App_Themes/YourTheme/images/<%#Eval("Name")%>.jpg" NavigateUrl="<%#Eval("NavigateUrl")%>"></asp:HyperLink>

User avatar
Cornerstone
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Nov 12, 2008 10:34 am

Re: Simple Category List Images

Post by Cornerstone » Mon Dec 15, 2008 9:24 am

Got the same error...

[[ConLib:SimpleCategoryList]] The server tag is not well formed.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Simple Category List Images

Post by mazhar » Mon Dec 15, 2008 9:36 am

Use this code

Code: Select all

<asp:HyperLink ID="CategoryLink" runat="server" ImageUrl='App_Themes/YourTheme/images/<%#Eval("Name")%>.jpg' NavigateUrl="<%#Eval("NavigateUrl")%>"></asp:HyperLink>

User avatar
Cornerstone
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Nov 12, 2008 10:34 am

Re: Simple Category List Images

Post by Cornerstone » Mon Dec 15, 2008 9:48 am

That code did put image place holders in, but the pathing was wrong and the links were wrong.

Example is...

Image url = http://www.site.com/ConLib/App_Themes/T ... %25%3E.jpg

Link url = http://www.site.com/ConLib/%22%3C%25#Ev ... Url%22)%25

Any ideas?

Thanks again.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Simple Category List Images

Post by mazhar » Tue Dec 16, 2008 7:41 am

Here is the modified version of SimpleCategoryList control, check this out.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Simple Category List Images

Post by mazhar » Tue Dec 16, 2008 7:47 am

One thing more you need to update the following line in the code file so that it picks the image from your current template.

Code: Select all

string imagePath = "~/App_Themes/AbleCommerce/images/" + name + ".jpg";
For this you will have to change Ablecommerce to your custom store theme name if you are using some other store theme. It would be something like

Code: Select all

string imagePath = "~/App_Themes/YourStoreThemeName/images/" + name + ".jpg";
Just replace your YourStoreThemeName with actual name of your store current theme.

User avatar
Cornerstone
Ensign (ENS)
Ensign (ENS)
Posts: 18
Joined: Wed Nov 12, 2008 10:34 am

Re: Simple Category List Images

Post by Cornerstone » Tue Dec 16, 2008 8:17 am

Thanks so much! It worked perfectly. I really appriciate you helping me in figuring this out.

Post Reply