Sort order for products

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
User avatar
gio50000
Commander (CMDR)
Commander (CMDR)
Posts: 123
Joined: Mon Feb 18, 2008 12:51 pm
Location: Orlando, FL
Contact:

Sort order for products

Post by gio50000 » Thu Aug 21, 2008 2:04 pm

My client wants to display products in a specific order on several pages. I logged into AC and tried using the arrows on the catalog page to sort items and even clicked the sort category button to change the order. Neither of them changed how the products displayed on the pages. By the default the pages have a drop down menu that sorts items from A-Z. Is there a way to over-ride it and display products in a specific order? Am I missing something simple?

Thanks,
Gio
Thank you,
Gio

User avatar
gio50000
Commander (CMDR)
Commander (CMDR)
Posts: 123
Joined: Mon Feb 18, 2008 12:51 pm
Location: Orlando, FL
Contact:

Re: Sort order for products

Post by gio50000 » Mon Aug 25, 2008 10:28 am

I'm trying to list the products in a specific order. I tried sorting items using the arrows and the sort category feature but no success. Is the drop down menu on the products page (http://www.p51store.com/Apparel-C9.aspx) not allowing the to happen?

Any ideas?

Thanks,
Gio
Thank you,
Gio

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

Re: Sort order for products

Post by jmestep » Mon Aug 25, 2008 10:33 am

The override depends on what page you are using to display the category products.
CategoryGrid4.ascx can be changed by adding a line to the top of the sort box:
<asp:DropDownList ID="SortResults" runat="server" AutoPostBack="true" CssClass="sorting" EnableViewState="false">
<asp:ListItem Text="< Select Sort Order >" Value="" Selected="True"></asp:ListItem>
<asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
<asp:ListItem Text="By Name (Z -> A)" Value="Name DESC"></asp:ListItem>
<asp:ListItem Text="Featured" Value="IsFeatured DESC, Name ASC"></asp:ListItem>
<asp:ListItem Text="By Price (Low to High)" Value="Price ASC"></asp:ListItem>
<asp:ListItem Text="By Price (High to Low)" Value="Price DESC"></asp:ListItem>
<asp:ListItem Text="By Manufacturer (A -> Z)" Value="Manufacturer ASC"></asp:ListItem>
<asp:ListItem Text="By Manufacturer (Z -> A)" Value="Manufacturer DESC"></asp:ListItem>
</asp:DropDownList>

Some of the other pages can be changed in the .cs file with putting the String.Empty in as below
//SORT THE CATEGORIES ACCORDINGLY
// jme 050608 string sortExpression = SortResults.SelectedValue;
string sortExpression = String.Empty;
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

User avatar
gio50000
Commander (CMDR)
Commander (CMDR)
Posts: 123
Joined: Mon Feb 18, 2008 12:51 pm
Location: Orlando, FL
Contact:

Re: Sort order for products

Post by gio50000 » Mon Aug 25, 2008 11:10 am

jmestep - Change the sort order in the admin section then add "<asp:ListItem Text="< Select Sort Order >" Value="" Selected="True"></asp:ListItem>" to the aspx file. That will do it?

Gio
Thank you,
Gio

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

Re: Sort order for products

Post by jmestep » Mon Aug 25, 2008 12:58 pm

That might do it. I had to use that on one category conlib because the following wasn't available in the .cs file for that conlib
// jme 050608 string sortExpression = SortResults.SelectedValue;
string sortExpression = String.Empty;

Both these methods have worked for me. I like the String.Empty better, but could not get a piece of similar code for the other conlib, so I had to resort to the Select sort order for it.
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

it@isa-arbor.com
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Aug 15, 2008 7:56 am

Re: Sort order for products

Post by it@isa-arbor.com » Tue Oct 21, 2008 8:27 am

Can this be done with CategoryGridPage.aspx

I can't find the analogous code in the .cs file to modify there. I can add the option to the sort drop down list, but it still doesn't sort the way I want it too.

There are many posts on this subject, but I'm still a bit stuck.

Thanks,

Ernie Noa

nathanc
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Tue Oct 21, 2008 7:17 am

Re: Sort order for products

Post by nathanc » Tue Oct 21, 2008 8:36 am

Your sort order should be set by default to "NORMAL" which allows you to set the order of your product in the admin and have it stay that way by default until the customer decides to change the view for themself. I had this issue too, as the "NORMAL" selection was not there. Someone at AC helped suggest how to correct this problem. Unfortunately, I do not remember how. You can check out my site to see it working.

Nathan Cantkier
Site Administrator
Discounter's Pool & Spa Warehouse
A DIVISION OF CDS
Tel: 416-665-8006 x 253
Fax: 416-665-7400
Toll Free: 1-800-237-5565 x 253
email: nathancantkier@discounterspoolandspa.com
http://www.discounterspoolandspa.com

it@isa-arbor.com
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Aug 15, 2008 7:56 am

Re: Sort order for products

Post by it@isa-arbor.com » Tue Oct 21, 2008 8:57 am

I've got it fixed. I was able to add a category to the drop down previously but not affect the sort. I changed my new option to have a value of NORMAL. This seems to have corrected the problem.

Thank you very much for your help.

User avatar
gio50000
Commander (CMDR)
Commander (CMDR)
Posts: 123
Joined: Mon Feb 18, 2008 12:51 pm
Location: Orlando, FL
Contact:

Re: Sort order for products

Post by gio50000 » Tue Oct 21, 2008 9:10 am

Could you outline how you fixed it?

Thanks,
Gio
Thank you,
Gio

it@isa-arbor.com
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Aug 15, 2008 7:56 am

Re: Sort order for products

Post by it@isa-arbor.com » Tue Oct 21, 2008 9:21 am

Sure, a few posts ago in this thread someone suggested.


Adding the following to ascx file to add a blank sort selection.
<asp:DropDownList ID="SortResults" runat="server" AutoPostBack="true" CssClass="sorting" EnableViewState="false">
<asp:ListItem Text="< Select Sort Order >" Value="" Selected="True"></asp:ListItem>
<asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
<asp:ListItem Text="By Name (Z -> A)" Value="Name DESC"></asp:ListItem>
<asp:ListItem Text="Featured" Value="IsFeatured DESC, Name ASC"></asp:ListItem>
<asp:ListItem Text="By Price (Low to High)" Value="Price ASC"></asp:ListItem>
<asp:ListItem Text="By Price (High to Low)" Value="Price DESC"></asp:ListItem>
<asp:ListItem Text="By Manufacturer (A -> Z)" Value="Manufacturer ASC"></asp:ListItem>
<asp:ListItem Text="By Manufacturer (Z -> A)" Value="Manufacturer DESC"></asp:ListItem>
</asp:DropDownList>


The line <asp:ListItem Text="< Select Sort Order >" Value="" Selected="True"></asp:ListItem>

Can be modified to read:
<asp:ListItem Text="< Select Sort Order >" Value="NORMAL" Selected="True"></asp:ListItem>

This seemed to do the trick for me.

it@isa-arbor.com
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Aug 15, 2008 7:56 am

Re: Sort order for products

Post by it@isa-arbor.com » Fri Oct 31, 2008 8:42 am

This works great for me on CategoryGridPage4 but fails on GategoryGridPage and SearchPage. I'm using GategoryGridPage4 most of the time, but have been asked to make the product finder default to the order the products are sorted in the back end. If I put in the change mentioned above I get and error reading Invalid column name 'NORMAL'. This must be calling a different query or using a different function, but I can't quite figure it out.

cmorganmcp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Mon Dec 08, 2008 10:41 am

Re: Sort order for products

Post by cmorganmcp » Thu Jan 08, 2009 4:09 pm

I'm in the same boat here... I'm essentially using a copy of CategoryGridPage but can't get the sorting to reflect what I've set manually as an admin. NORMAL gives an invalid column error. Anybody?

-chad

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Sort order for products

Post by mazhar » Fri Jan 09, 2009 8:14 am

Well currently the AbleCommerce 7 doesn't list the products as per admin adjusted order. It was a bug which is fixed for 7.2 version.
http://bugs.ablecommerce.com/show_bug.cgi?id=7453
If you use the following workaround

Code: Select all

<asp:ListItem Text="< Select Sort Order >" Value="" Selected="True"></asp:ListItem>
Then it will take care of the order in which products was actually added to catalog.

cmorganmcp
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Mon Dec 08, 2008 10:41 am

Re: Sort order for products

Post by cmorganmcp » Fri Jan 09, 2009 4:44 pm

I've tried setting the sort order to an empty string and it still doesn't reflect the admin sort order. I didn't realize 7.2 was available though so I'll look into that.

-chad

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Sort order for products

Post by mazhar » Sat Jan 10, 2009 5:19 am

I've tried setting the sort order to an empty string and it still doesn't reflect the admin sort order. I didn't realize 7.2 was available though so I'll look into that.
If you use the empty string then it will list the products with respect to the order in which you created the products on store. It will not care the merchant order at all. For example if you created product at store by entering their information as below

Product C
Product A
Product B

and then you adjusted the product order to look like

Product A
Product B
Product C

Now with empty list item it will list the order as

Product C
Product A
Product B

So with empty list item you actuly need to enter the products in desired order.

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Sort order for products

Post by bha » Sun Jan 11, 2009 12:10 am

Does anyone know where I could find documentation for SortedGridView which seems to be the extended version of GridView. Specifically, I'd like to sort on multiple columns.

If there is a nice simple way that has already been coded, I would greatly appreciate the help!

-Bruce.

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

Re: Sort order for products

Post by jmestep » Sun Jan 11, 2009 1:53 pm

There is a good usage of the sortegridview on Admin/Orders/Default.aspx. You can sort on all but Payment and Shipment by clicking on the headers of the columns. There is a little bit of documentation on it accessible in the ObjectBrowser in Visual Studio.
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

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Sort order for products

Post by bha » Sun Jan 11, 2009 8:01 pm

Thanks Judy,

By putting in multiple fields in the the DefaultSortExpression accompanied by either ASC (ascending) or DESC (descending) for each field, I was able to sort on multiple columns (a sub-sort within a main sort) under SortedGridView:

eg. DefaultSortExpression="Date DESC, Customer ASC"

By the way, anyone know where the code for SortedGridView resides? How I can display Paging for "NumericFirstLast" instead of the default Numeric. In other words, I'd like to have a First and Last page paging function as well.

-Bruce

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Sort order for products

Post by mazhar » Mon Jan 12, 2009 6:39 am

SortedGridView exists in CommerceBuilder.Web.dll.
How I can display Paging for "NumericFirstLast"
For example suppose we want this change on Admin/Order/Default.aspx then you need to locate the following line of code on that page

Code: Select all

</EmptyDataTemplate>
and change it too look like

Code: Select all

</EmptyDataTemplate>
<PagerSettings Mode="NumericFirstLast" />

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Sort order for products

Post by bha » Mon Jan 12, 2009 8:04 am

Did not work.

</EmptyDataTemplate>
<PagerSettings Mode="NumericFirstLast" />
</cb:SortedGridView>

Perhaps custom gridview in Dll might be overiding this paging function?

-Bruce

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Sort order for products

Post by bha » Mon Jan 12, 2009 3:10 pm

Resorted to code:

Code: Select all

protected void Page_Load(object sender, EventArgs e)
{
	grd_OrderItems.PagerSettings.Mode = PagerButtons.NumericFirstLast;
}

ocf@rme-w.com
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Sun Dec 21, 2008 2:15 am

Re: Sort order for products

Post by ocf@rme-w.com » Thu Jan 15, 2009 3:35 am

We are setting up our new store/site on a Able Commerce server package and are about ready to switch from our existing ISP and open the new store. We are also needing a specific product sort order from our admin specified order.

Our installation is V 7.1 . According to the forums, this bug is corrected in version 7.2. (see: this string Posted: Fri Jan 09, 2009 7:14 am by Mazhar) "Well currently the AbleCommerce 7 doesn't list the products as per admin adjusted order. It was a bug which is fixed for 7.2 version."

How do we get 7.2 ??? Is this an entitlement with the server package? If so, when will version 7.2 be released and installed.

Thanks

musthavebag
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Fri Sep 12, 2008 8:41 am

Re: Sort order for products

Post by musthavebag » Tue Apr 14, 2009 7:11 pm

Well currently the AbleCommerce 7 doesn't list the products as per admin adjusted order. It was a bug which is fixed for 7.2 version.
http://bugs.ablecommerce.com/show_bug.cgi?id=7453
Hi Mazhar - We're using 7.0.2 build 11659 with a modified version of CategoryGrid.aspx We're assuming 7.0.2 is the same version in which you've fixed the issue of the products not sorting as per admin adjusted order yet we can't seem to figure out how to get this to work. We are attaching a copy of our modified CategoryGrid.aspx file. Would you be kind as to point us to the key lines of code in our modified file that control the product sort issue? Are there any recommended modifications/additions we need to make to get this working? Any help would be greatly appreciated.
Thanks,
Alexandra

http://test.musthavebag.com

Code: Select all

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CategoryGridPage.ascx.cs" Inherits="ConLib_CategoryGridPage" %>
<%--
<conlib>
<summary>The defualt category page that displays products in a grid format. Allows customers to browse your catalog.</summary>
<param name="DefaultCaption" default="Catalog">Caption text that will be shown as caption when root category will be browsed.</param>
<param name="DisplayBreadCrumbs" default="true">Indicates wheather the breadcrumbs should be displayed or not, default value is true.</param>
<param name="PagingLinksLocation" default="BOTTOM">Indicates where the paging links will be displayd, possible values are "TOP", "BOTTOM" and "TOPANDBOTTOM".</param>
</conlib>
--%>
<%@ Register Src="~/ConLib/CategoryBreadCrumbs.ascx" TagName="CategoryBreadCrumbs" TagPrefix="uc" %>
<%@ Register Src="~/ConLib/CategorySearchSidebar.ascx" TagName="CategorySearchSidebar" TagPrefix="uc" %>
<%@ Register Src="~/ConLib/Utility/ProductPrice.ascx" TagName="ProductPrice" TagPrefix="uc" %>
<%@ Register Src="~/ConLib/AddToCartLink.ascx" TagName="AddToCartLink" TagPrefix="uc" %>
<!-- ConLib/CategoryGridPage.ascx -->
<ajax:UpdatePanel ID="SearchResultsAjaxPanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:PlaceHolder ID="CategoryHeaderPanel" runat="server" EnableViewState="false">
            <uc:CategoryBreadCrumbs id="CategoryBreadCrumbs1" runat="server" HideLastNode="True" />
			
            <div class="pageHeader">
                <h1><asp:Localize ID="Caption" runat="server" EnableViewState="False"></asp:Localize></h1>
            </div>
          
        <div class="searchSortHeader">
            <table width="100%" cellpadding="3" cellspacing="0" border="0">
                <tr>
                    <td align="left">
					
                        <asp:Label ID="ResultIndexMessage" runat="server" Text="Displaying items {0} - {1} of {2}" EnableViewState="false"></asp:Label>
                    </td>
                    <td align="right">
                        <asp:Label ID="SortResultsLabel" runat="server" Text="Sort:" SkinID="FieldHeader"></asp:Label>&nbsp;
                        <asp:DropDownList ID="SortResults" runat="server" AutoPostBack="true" CssClass="sorting" OnSelectedIndexChanged="SortResults_SelectedIndexChanged">
			    <asp:ListItem Text="By Name (A -> Z)" Value="Name ASC"></asp:ListItem>
                            <asp:ListItem Text="By Name (Z -> A)" Value="Name DESC"></asp:ListItem>
                            <asp:ListItem Text="Featured" Value="IsFeatured DESC, Name ASC"></asp:ListItem>
                            <asp:ListItem Text="By Price (Low to High)" Value="Price ASC"></asp:ListItem>
                            <asp:ListItem Text="By Price (High to Low)" Value="Price DESC"></asp:ListItem>                            
                            <asp:ListItem Text="By Manufacturer (A -> Z)" Value="Manufacturer ASC"></asp:ListItem>
                            <asp:ListItem Text="By Manufacturer (Z -> A)" Value="Manufacturer DESC"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
            </table>
        </div>
        <!-- Top Bar -->
<div class="catagoriesBody">
<div class="catTopBg"></div>
<div class="cateDetailsInner">
        <div class="catalogWrapper">
		
		  <asp:PlaceHolder ID="SubCategoryPanel" runat="server" EnableViewState="false">
                <div class="section">
                    <div class="content">
						<div id="subF">
                        <asp:Repeater ID="SubCategoryRepeater" runat="server" EnableViewState="false">
                            <SeparatorTemplate>, </SeparatorTemplate>
                            <ItemTemplate><asp:HyperLink ID="SubCategoryLink" runat="server" Text='<%#String.Format("{0} ({1})", Eval("Name"), Eval("ProductCount"))%>' NavigateUrl='<%#Eval("NavigateUrl")%>'></asp:HyperLink></ItemTemplate>
                        </asp:Repeater>
						</div>
                    </div>
                </div>
            </asp:PlaceHolder>
        </asp:PlaceHolder>
		
		
		
            <asp:Panel ID="PagerPanelTop" runat="server" Visible="false">
	            <div class="paging">
	                <asp:Repeater ID="PagerControlsTop" runat="server" OnItemCommand="PagerControls_ItemCommand">
		            <ItemTemplate>
		                <a class='<%#Eval("TagClass")%>'  href='<%#Eval("NavigateUrl")%>'><%#Eval("Text")%></a>
		            </ItemTemplate>
	                </asp:Repeater>
	            </div>
            </asp:Panel> 
            <asp:DataList ID="ProductList" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" Width="100%" 
                OnItemDataBound="ProductList_ItemDataBound" DataKeyField="ProductId" CssClass="catalog" EnableViewState="false" HorizontalAlign="left">
                <ItemStyle HorizontalAlign="center" VerticalAlign="bottom" Width="33%" CssClass="tableNode" />
                <ItemTemplate>
                    <asp:PlaceHolder ID="phItemTemplate1" runat="server"></asp:PlaceHolder>
                    <uc:ProductPrice ID="Price" runat="server" Product='<%#Container.DataItem%>' ShowRetailPrice="true" />
                    <asp:PlaceHolder ID="phItemTemplate2" runat="server"></asp:PlaceHolder>
                    <div style="margin-top:10px;margin-bottom:20px"><uc:AddToCartLink ID="Add2Cart" runat="server" ProductId='<%#Eval("ProductId")%>' /></div>
                </ItemTemplate>
                <SeparatorTemplate>&nbsp;</SeparatorTemplate>
                <SeparatorStyle CssClass="separator" Width="1" />
            </asp:DataList><br clear="all" />
            <asp:Panel ID="PagerPanel" runat="server" >
                <div class="paging">
				<span class="pagingSpan"></span>
				<span class="pagingSpanHigh"></span>
				<span class="pagingSpanLow"></span>
				sort by price: <asp:LinkButton ID="linksorthigh" runat="server" Text="high" OnClick="linksorthigh_Click" ></asp:LinkButton> <asp:LinkButton ID="linksortlow" runat="server" Text="low" OnClick="linksortlow_Click" ></asp:LinkButton>  <asp:LinkButton ID="linkviewall" runat="server" Text="view all" OnClick="linkviewall_Click" ></asp:LinkButton> <asp:Label id="lblvieal" CssClass="lineSize" Text="|" runat="server"></asp:Label> <asp:Label ID="lblpageno" Text="page:" runat="server"></asp:Label> &nbsp;
                    <asp:Repeater ID="PagerControls" runat="server" OnItemCommand="PagerControls_ItemCommand">
                        <ItemTemplate>
                            <a class='<%#Eval("TagClass")%>'  href='<%#Eval("NavigateUrl")%>'><%#Eval("Text")%></a>
                        </ItemTemplate>
                    </asp:Repeater>
                </div>
            </asp:Panel>                    
            <div align="center">
                <asp:Label ID="NoSearchResults" runat="server" Text="No products match your search criteria." Visible="false"></asp:Label>
            </div>
            <asp:HiddenField ID="HiddenPageIndex" runat="server" Value="0" />
       </div>
	    </div>
	<div class="catBottomBg"></div>
</div>
    </ContentTemplate>
</ajax:UpdatePanel>

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Sort order for products

Post by mazhar » Fri Apr 17, 2009 10:35 am

Well CategoryGridPage display all product and categories from current category and also from its child's, So sort order doesn't make sense with CategoryGridPage. Better use CategoryList page that shows contents of single category at time, pass empty string as sort parameter it will take care of sort order. Those products which reside in multiple categories may not be shown in proper order that is a known and reported issue.

musthavebag
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Fri Sep 12, 2008 8:41 am

Re: Sort order for products

Post by musthavebag » Sun Apr 19, 2009 6:46 am

One of the reasons why we bought this software was to be able to sort products easily.

We use a grid, not list, format and basically what you are saying is that it cant work with a grid format?!! :shock:

Post Reply