Filtering products in a category by manufacturer

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 年 前
I have lots of products in each category and it's necessary to allow the user to filter them by manufacturer. I don't think NopCommerce allows this by default, but I was thinking of using a product specification instead of actual manufacturers. Is there a downside to this approach or NopCommerce actually allows filtering by manufactures and I didn't know?
13 年 前
You're right. It'll require some customization. Follow the next steps:
1. Add manufacturer dropdownlist to your category details page (\Templates\Categories\ProductsInGrid.ascx, \Templates\Categories\ProductsInLines1.ascx and \Templates\Categories\ProductsInLines2.ascx controls)
2. Populate it with manufacturers:
var manufacturers = ManufacturerManager.GetAllManufacturers();
rptrManufacturers.DataSource = manufacturers;
rptrManufacturers.DataBind();

3. Set manufacturer AutoPostBack property to "true"
4. Subsribe to its SelectedIndexChanged changed event (OnSelectedIndexChanged="ddlManufacturer_OnSelectedIndexChanged") and invoke Bind() method in its handler (ddlManufacturer_OnSelectedIndexChanged)
5. Modify Bind() method to pass selected manufacturer identifier to ProductManager.GetAllProducts(...) method

P.S. And of course you can use a product specification instead of actual manufacturers
13 年 前
This customization is very critical for us. Could you explain it a bit more.
13 年 前
Can I push this topic on again. I want to filter by manufacturers too.

I have four manufacturers and I want an image link from the home page to filter all products to the manufacturer selected. So a user is only browsing the site for that one manufacturer.

My C# is OK but not good enough yet for this. I think this is a pretty easy and a useful mod to do.

I understand what Andrei's post is doing but it's still short of a bit of code for me to do yet and I need it from the home page as an image hyperlink not a dropdown from the category.aspx.

Any help for this from anyone please - thanks
13 年 前
a.m. wrote:
You're right. It'll require some customization. Follow the next steps:
1. Add manufacturer dropdownlist to your category details page (\Templates\Categories\ProductsInGrid.ascx, \Templates\Categories\ProductsInLines1.ascx and \Templates\Categories\ProductsInLines2.ascx controls)
2. Populate it with manufacturers:
var manufacturers = ManufacturerManager.GetAllManufacturers();
rptrManufacturers.DataSource = manufacturers;
rptrManufacturers.DataBind();

3. Set manufacturer AutoPostBack property to "true"
4. Subsribe to its SelectedIndexChanged changed event (OnSelectedIndexChanged="ddlManufacturer_OnSelectedIndexChanged") and invoke Bind() method in its handler (ddlManufacturer_OnSelectedIndexChanged)
5. Modify Bind() method to pass selected manufacturer identifier to ProductManager.GetAllProducts(...) method

P.S. And of course you can use a product specification instead of actual manufacturers


var manufacturers = ManufacturerManager.GetAllManufacturers();
rptrManufacturers.DataSource = manufacturers;
rptrManufacturers.DataBind();

In this code you try to select all manufacturers and transfer it to DataBind of ProductsInLines2, but how i can select all manufacturers by CategoryId, can you make some examples or ready solutions?
12 年 前
Hello, how would you solve it now in version 2.1?
12 年 前
how to please can be done in the razor version 2.1?
12 年 前
Has anyone managed to implement this into 2.1?

Many thanks,

Dave
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.