Number Of Manufacturer Display

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

I have a question regarding the manufacturer list displayed on the screen. I have about 550 product manufactueres. I do want to give my clients an ability to select by the manufacturer.

On the home screen I want to only display 10 manufacturer, but if they want to slect on there own, they can press view all.

The problem I am having is how to limit to 10 display names. I added all the manufactures to the DB, but by default all are displaying on the home screen.

Please advise.
13 years ago
The easiest way will be:
1. Open \Modules\ManufacturerNavigation.ascx.cs file
2. Add "using System.Linq;" namespace
3. Replace
var manufacturers = ManufacturerManager.GetAllManufacturers();

with
var manufacturers = ManufacturerManager.GetAllManufacturers().Take(10);
13 years ago
what you mean by 2. Add "using System.Linq;" namespace?
13 years ago
kakoli wrote:
what you mean by 2. Add "using System.Linq;" namespace?


In your .cs file, at the top you will see lines of code like this:

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using etc etc.....and so on...

just add "using System.Linq;"  in those code lines

and do the other modification that Andrei mentioned above...
13 years ago
I tried this, but it did not worked. Still getting all the manufacturers displayed on the Main page.
13 years ago
Don't forget to recompile your solution
13 years ago
Hi,

I recompiled the solution. But, it's still showing 500 manufacturers on the left Navigation panel.

I changed Manufacturer Navigation.aspx.cs

using System.Linq;

        protected void BindData()
        {
            //var manufacturers = ManufacturerManager.GetAllManufacturers();
            var manufacturers = ManufacturerManager.GetAllManufacturers().Take(10);
            if (manufacturers.Count() > 0)
            {
                rptrManufacturers.DataSource = manufacturers;
                rptrManufacturers.DataBind();
            }
            else
                this.Visible = false;
        }
13 years ago
May be I am doing something wrong. Did you meant that I have to build the solution again.

Doest doing ctrl-f5 automatically build and recompile the whole thing....
13 years ago
Hi Andrei,

I got my site to use another feature to resolve the above issue. I have converted a list to have an veritcal scrollbar. That way all the manufactures can be displayed.


But, I am another question If you could please advise.

I am trying to link the tags with the Manufacturer / Categories. For example, If a product is Manufactured by M1 and the Product is P1. I link it to tag M & P.

Now, on my screen I want users to have the ability when they are viewing all the product as follows

If in Category Screen - get all the products with selected tag and that category. So, I changed the follwing to do this.

ProductByTag.ascx.cs

var productCollection = ProductManager.GetAllProducts(CategoryID, ManufacturerID,
                productTag.ProductTagId, false, null, null,
                string.Empty, false, pageSize, this.CurrentPageIndex,
                null, ProductSortingEnum.Position, out totalRecords);

       //added properties
        public int CategoryID
        {
            get
            {
                return CommonHelper.QueryStringInt("CategoryId");
            }
        }
        public int ManufacturerID
        {
            get
            {
                return CommonHelper.QueryStringInt("ManufacturerId");
            }
        }
        //@added properties


Please adviuse, if this is correct. I am not able to determine is selecting a particular popular tag does call this ascx.
13 years ago
a.m. wrote:
The easiest way will be:
1. Open \Modules\ManufacturerNavigation.ascx.cs file
2. Add "using System.Linq;" namespace
3. Replace
var manufacturers = ManufacturerManager.GetAllManufacturers();

with
var manufacturers = ManufacturerManager.GetAllManufacturers().Take(10);


You also need to change the next line...

From:

     if (manufacturers.Count > 0)

To:

    if (manufacturers.Count() > 0)

Notice the use of Parenthesis.  This is a confirmed fix!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.