Compare List Set Max Item = 3

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello, can anyone please help me?  I'm using version 1.8

The Compare List is set to always have 4 maximum items to compare.  I want to set it so that it's only 3 (Else it would be overflowing in the layout).  I'm trying to edit CompareProducts.ascx.cs

How could I set it so that compareProducts.Count < 4  so it stops generating rows and columns after 3 items?  Thank you.
12 years ago
Nvm. I found it, it's in the Libraries > Nop.BusinessLogic > Products > ProductManager.cs just set maxProducts = 3;


var newProductIds = new List<int>();
        newProductIds.Add(productId);
        foreach (int oldProductId in oldProductIds)
          if (oldProductId != productId)
            newProductIds.Add(oldProductId);

        HttpCookie compareCookie = HttpContext.Current.Request.Cookies.Get("NopCommerce.CompareProducts");
        if (compareCookie == null)
          compareCookie = new HttpCookie("NopCommerce.CompareProducts");
        compareCookie.Values.Clear();
        int maxProducts = 3;
        int i = 1;
        foreach (int newProductId in newProductIds)
        {
          compareCookie.Values.Add("CompareProductIds", newProductId.ToString());
          if (i == maxProducts)
            break;
          i++;
        }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.