Hi Kurko,
It's been a lot time since I created this post. I have found a solution but I don't remember all the details:) I'm posting the code I created anyway, you could test it and see how it goes.
file: Templates/Categories/ProductsInGrid.ascx. Replace dlProducts datalist with the following:
<div class="product-grid">
<asp:DataList ID="dlProducts" runat="server" RepeatColumns="3" RepeatDirection="Horizontal"
RepeatLayout="Table" ItemStyle-CssClass="item-box">
<ItemTemplate>
<nopCommerce:ProductBox1 ID="ctrlProductBox" Product='<%# Container.DataItem %>'
runat="server" />
</ItemTemplate>
</asp:DataList>
</div>
<div class="clear"></div>
file: Templates/Categories/ProductsInGrid.ascx.cs Replace BindData() and dlSubCategories_ItemDataBound() functions, using the following:
protected void BindData()
{
var category = CategoryManager.GetCategoryById(this.CategoryId);
//breadcrumb
rptrCategoryBreadcrumb.DataSource = CategoryManager.GetBreadCrumb(this.CategoryId);
rptrCategoryBreadcrumb.DataBind();
lDescription.Text = category.LocalizedDescription;
//subcategories
var subCategories = CategoryManager.GetAllCategoriesByParentCategoryId(category.CategoryId);
if (subCategories.Count > 0)
{
dlSubCategories.Visible = false;
}
else
dlSubCategories.Visible = false;
//featured products
var featuredProducts = category.FeaturedProducts;
if (featuredProducts.Count > 0)
{
dlFeaturedProducts.DataSource = featuredProducts;
dlFeaturedProducts.DataBind();
}
else
{
pnlFeaturedProducts.Visible = false;
}
//price ranges
this.ctrlPriceRangeFilter.PriceRanges = category.PriceRanges;
//page size
int totalRecords = 0;
int pageSize = 10;
if (category.PageSize > 0)
{
pageSize = category.PageSize;
}
//price ranges
decimal? minPrice = null;
decimal? maxPrice = null;
decimal? minPriceConverted = null;
decimal? maxPriceConverted = null;
if (ctrlPriceRangeFilter.SelectedPriceRange != null)
{
minPrice = ctrlPriceRangeFilter.SelectedPriceRange.From;
if (minPrice.HasValue)
{
minPriceConverted = CurrencyManager.ConvertCurrency(minPrice.Value, NopContext.Current.WorkingCurrency, CurrencyManager.PrimaryStoreCurrency);
}
maxPrice = ctrlPriceRangeFilter.SelectedPriceRange.To;
if (maxPrice.HasValue)
{
maxPriceConverted = CurrencyManager.ConvertCurrency(maxPrice.Value, NopContext.Current.WorkingCurrency, CurrencyManager.PrimaryStoreCurrency);
}
}
//specification filter
var psoFilterOption = ctrlProductSpecificationFilter.GetAlreadyFilteredSpecOptionIds();
//sorting
ProductSortingEnum orderBy = ProductSortingEnum.CreatedOn;
if (SettingManager.GetSettingValueBoolean("Common.AllowProductSorting"))
{
CommonHelper.SelectListItem(this.ddlSorting, CommonHelper.QueryStringInt("orderby"));
orderBy = (ProductSortingEnum)Enum.ToObject(typeof(ProductSortingEnum), int.Parse(ddlSorting.SelectedItem.Value));
}
var productCollection = ProductManager.GetAllProducts(this.CategoryId,
0, 0, false, minPriceConverted, maxPriceConverted,
string.Empty, false, pageSize, this.CurrentPageIndex,
psoFilterOption, orderBy, out totalRecords);
if (productCollection.Count > 0)
{
this.productsPager.PageSize = pageSize;
this.productsPager.TotalRecords = totalRecords;
this.productsPager.PageIndex = this.CurrentPageIndex;
this.dlProducts.DataSource = productCollection;
this.dlProducts.DataBind();
}
else
{
this.dlProducts.Visible = false;
this.pnlSorting.Visible = false;
}
}
protected void dlSubCategories_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
var category = e.Item.DataItem as Category;
string categoryURL = SEOHelper.GetCategoryUrl(category);
var hlImageLink = e.Item.FindControl("hlImageLink") as HyperLink;
if (hlImageLink != null)
{
hlImageLink.ImageUrl = PictureManager.GetPictureUrl(category.PictureId, SettingManager.GetSettingValueInteger("Media.Category.ThumbnailImageSize", 125), true);
hlImageLink.NavigateUrl = categoryURL;
hlImageLink.ToolTip = String.Format(GetLocaleResourceString("Media.Category.ImageLinkTitleFormat"), category.LocalizedName);
hlImageLink.Text = String.Format(GetLocaleResourceString("Media.Category.ImageAlternateTextFormat"), category.LocalizedName);
}
var hlCategory = e.Item.FindControl("hlCategory") as HyperLink;
if (hlCategory != null)
{
hlCategory.NavigateUrl = categoryURL;
hlCategory.ToolTip = String.Format(GetLocaleResourceString("Media.Category.ImageLinkTitleFormat"), category.LocalizedName);
hlCategory.Text = Server.HtmlEncode(category.LocalizedName);
}
}
}
I think that's all you need. Let me know if that worked for you.