Category images- sitemap. Is it possible?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Category images- sitemap. Is it possible?

Post by William_firefold » Tue Aug 11, 2009 11:56 am

I would like to run the yahoo Smush.IT image optimizer( http://developer.yahoo.com/yslow/turd/ *edit-anyone know why this forum is concatenating the word "turd" on my url?) on the category and product thumbnails in our store. It showed a dramatic improvement in file size, but requires you to use a web address for it to optimize the files.

Is there an easy way to make Able display every category on a single page? Every product?


User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: Category images- sitemap. Is it possible?

Post by William_firefold » Thu Aug 13, 2009 12:32 pm

I used mazhars code to work up something which will display category or product images, depending on which method you call. I used this and have saved 45MB of image data on our product lines thumbnails with Smush.it. About a 60% reduction across the board.

Code: Select all

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SiteMap2.ascx.cs" Inherits="ConLib_SiteMap2" %>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<ajax:UpdatePanel ID="DescriptionAjax" runat="server">
    <ContentTemplate>
    <div align="center">
        <table cellspacing="0" cellpadding="0" border="0" id="sitemap">
        <tr>
        <td class="sitemapTop" valign="middle" align="right"><span style="visibility:hidden;"><a name="sitemapTop"></a></span><a href="#sitemapBot">Go To Bottom</a>&nbsp;</td>
        </tr>
        <tr>
        <td class="sitemapRepeat"><asp:Literal ID="CategoryLinks" runat="server"></asp:Literal></td>
        </tr>
        <tr>
        <td class="sitemapBot" valign="middle" align="right"><span style="visibility:hidden;"><a name="sitemapBot"></a></span><a href="#sitemapTop">Go To Top</a>&nbsp;</td>
        </tr>
        </table>
    </div>
    </ContentTemplate>
</ajax:UpdatePanel>

Code: Select all

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CommerceBuilder.Common;
using CommerceBuilder.Utility;
using CommerceBuilder.Products;
using CommerceBuilder.Catalog;

public partial class ConLib_SiteMap2 : System.Web.UI.UserControl
{
    static String myCategoryLinks = "";
    static int recursiveCount = 0;
	static int recursionDepth = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        recursiveCount = 0;
        CategoryLinks.Text = "<div style=\"margin:10px;\">";
        RecursiveLoadParents(0,0);
        CategoryLinks.Text += myCategoryLinks + "</div>";
    }

    protected static void RecursiveLoadParents(int CatId,int recursionDepth)
    {
		CategoryCollection cc = CategoryDataSource.LoadForParent(CatId, true);
		foreach (Category c in cc)
		{
		if(c.ThumbnailUrl.ToString().Length>2)
			myCategoryLinks += "<img src=\""+ c.ThumbnailUrl.ToString().Substring(2)+"\"/>";
			
			RecursiveLoadParents(c.CategoryId,recursionDepth+1);
		}
	}
	    protected static void RecursiveLoadParentsProduct(int CatId,int recursionDepth)
    {
		ProductCollection cc = ProductDataSource.LoadForStore();
		foreach (Product c in cc)
		{
		if(c.ThumbnailUrl.ToString().Length>2)
			myCategoryLinks += "<img src=\""+ c.ThumbnailUrl.ToString().Substring(2)+"\"/>";
			
			//RecursiveLoadParents(c.ProductId,recursionDepth+1);
		}
	}
}

Post Reply