Page 1 of 1

Filter Products

Posted: Thu Mar 19, 2009 5:27 pm
by cgreathouse
First I must say how impressed I am with the responsiveness of this forum. I've never seen a forum where questions get answered so quickly. :D

Now for my question:

I'm looking how to filter products based on group. I've already made the changes on the admin side for keeping track of what products are visible to what groups. Now I just need to modify the user side. I know what products should be visible for a given user, I just need to know where to filter out products.

Anybody have any pointers on what needs to change on the user side to prevent products from being displayed?

Thanks!

Re: Filter Products

Posted: Fri Mar 20, 2009 5:47 am
by mazhar
Perhaps you need to write custom queries to filter products. Read following WIKI topics about DAL.
http://wiki.ablecommerce.com/index.php/ ... cess_Layer
http://wiki.ablecommerce.com/index.php/Custom_Queries

Re: Filter Products

Posted: Fri Mar 20, 2009 8:06 am
by cgreathouse
Yes, I've looked at those. I'm using the DAL for the admin side of things. I've already made the changes that will allow an admin to specify the products that are visible for a particular group. Now I just need to do the actual filtering.

What I'm trying to find is what AbleCommerce file(s) need to be changed to do the filtering. I'm trying to find where to make the changes but I'm not having any luck.

Can you point me in the right direction?

Thanks!

Re: Filter Products

Posted: Fri Mar 20, 2009 8:18 am
by mazhar
The changes will most probably in ProductDataSource class's methods. As this class is in an API class so for this you will need API source code. The other solution is to write you custom code to filter products and then update Category pages to use that code.

Re: Filter Products

Posted: Fri Mar 20, 2009 8:39 am
by cgreathouse
"...The other solution is to write you custom code to filter products and then update Category pages to use that code...."

Yes, that's what I'd like to try. I browsed through some Category pages and I'm not seeing how Products are getting loaded. Am I just not seeing it? Can you point me to a specific location where I can override how Products are loaded for a Category?

Thanks again!

Re: Filter Products

Posted: Fri Mar 20, 2009 8:48 am
by mazhar
For example in ConLib/CategoryGridPage.ascx.cs file following line is loading products

Code: Select all

ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);

Re: Filter Products

Posted: Fri Mar 20, 2009 9:19 am
by cgreathouse
YES!!! That's what I was looking for.

Thanks!