Product Sorting on CategoryGridPage

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
corgalore
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 32
Joined: Thu Nov 08, 2012 2:57 pm

Product Sorting on CategoryGridPage

Post by corgalore » Thu Nov 08, 2012 3:19 pm

The product list does not seem to obey the manual sorting applied when using the CategoryGridPage and a sort selection of Featured. If I switch to CategoryList it works just fine.

I have done some code research and can't seem to find out how the query is built in the Gold version.

Any ideas?

User avatar
Psalty
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 31
Joined: Thu Sep 20, 2007 7:12 am

Re: Product Sorting on CategoryGridPage

Post by Psalty » Mon Nov 12, 2012 1:46 pm

I am also experiencing this issue. In the ac_CatalogNodes table it looks like it is sorting by the "Id" field rather than by the "OrderBy" field. Is there a time table for getting this fixed?

User avatar
MisterMike
Ensign (ENS)
Ensign (ENS)
Posts: 12
Joined: Tue Apr 16, 2013 7:37 am

Re: Product Sorting on CategoryGridPage

Post by MisterMike » Fri Aug 30, 2013 7:39 am

I'm having the same issue when changing the Sort from Featured to any of the other choices (By Name, By Price). When I change the sort, it changes the current page, but when I click to go to the next page the sort changes back to Featured. This is very confusing and cannot possibly be the intended behavior for this page. Has anyone found a fix?

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Product Sorting on CategoryGridPage

Post by jmestep » Fri Aug 30, 2013 8:28 am

What version of Gold are you using? Which search-Lucene, SQL, etc.? Which category grid page? There are some bugs.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Product Sorting on CategoryGridPage

Post by jguengerich » Fri Aug 30, 2013 9:40 am

For MisterMike's issue, this looks similar to an issue I had with the Search page in Gold R5. I fixed it by making the following changes. I haven't tested this on the CategoryGrid pages, but the code looks the same so it might work.

At the start of the Page_Load method (of CategeoryGridPage.ascx.cs for example) there is a nested if statement:

Code: Select all

            string eventTarget = Request["__EVENTTARGET"];
            if (string.IsNullOrEmpty(eventTarget) || !eventTarget.EndsWith("PageSizeOptions"))
            {
                string pageSizeOption = Request.QueryString["ps"];
                if (!string.IsNullOrEmpty(pageSizeOption))
                {
                    PageSizeOptions.ClearSelection();
                    ListItem item = PageSizeOptions.Items.FindByValue(pageSizeOption);
                    if (item != null) item.Selected = true;
                }
            }
            else
            if (eventTarget.EndsWith("PageSizeOptions"))
            {
                string url = Request.RawUrl;
                if (url.Contains("?"))
                    url = Request.RawUrl.Substring(0, Request.RawUrl.IndexOf("?"));
                url += "?s=" + SortResults.SelectedValue;
                url += "&ps=" + PageSizeOptions.SelectedValue;
                Response.Redirect(url);
            }
I changed it to this:

Code: Select all

            string eventTarget = Request["__EVENTTARGET"];
            if (string.IsNullOrEmpty(eventTarget) || !(eventTarget.EndsWith("PageSizeOptions") || eventTarget.EndsWith("SortResults")))
            {
                string pageSizeOption = Request.QueryString["ps"];
                if (!string.IsNullOrEmpty(pageSizeOption))
                {
                    PageSizeOptions.ClearSelection();
                    ListItem item = PageSizeOptions.Items.FindByValue(pageSizeOption);
                    if (item != null) item.Selected = true;
                }
            }
            else
            if (eventTarget.EndsWith("PageSizeOptions") || eventTarget.EndsWith("SortResults"))
            {
                string url = Request.RawUrl;
                if (url.Contains("?"))
                    url = Request.RawUrl.Substring(0, Request.RawUrl.IndexOf("?"));
                url += "?s=" + SortResults.SelectedValue;
                url += "&ps=" + PageSizeOptions.SelectedValue;
                Response.Redirect(url);
            }
You may also need to change the EnableViewState property of the SortResults DropDown control to true (in CategoryGridPage.ascx for example):

Code: Select all

<asp:DropDownList ID="SortResults" runat="server" AutoPostBack="true" CssClass="sorting" EnableViewState="false">
becomes

Code: Select all

<asp:DropDownList ID="SortResults" runat="server" AutoPostBack="true" CssClass="sorting" EnableViewState="true">
Again, I haven't tested this, but it is worth a shot.
Jay

User avatar
MisterMike
Ensign (ENS)
Ensign (ENS)
Posts: 12
Joined: Tue Apr 16, 2013 7:37 am

Re: Product Sorting on CategoryGridPage

Post by MisterMike » Fri Nov 22, 2013 9:43 am

My issues were resolved when I upgraded to Gold R6.

Post Reply