Change display order of email templates

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
WylieE
Captain (CAPT)
Captain (CAPT)
Posts: 281
Joined: Tue Mar 25, 2008 8:26 am
Location: Puyallup, WA
Contact:

Change display order of email templates

Post by WylieE » Wed Feb 18, 2009 11:50 am

Is there an easy was to rearrange the display (sort) order of email templates? We've created a number of custom emails and I'd like to reorder them for our admin staff. We've had a few instances of errant fingers sending the wrong emails and I need to reduce that risk.

Suggestions? Thanks!
Eric Wylie
Warmoth Guitar Products, Inc.
http://www.warmoth.com

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

Re: Change display order of email templates

Post by mazhar » Wed Feb 18, 2009 12:09 pm

There is no order by support for Email templates so that admin can adjust them. You can enable the sorting on the Email Templates grid with name or other column names. For example if you want to sort the Email Templates by name then you just need to enable the sorting for name in the Admin/Store/EmailTempaltes/Default.aspx page. Edit this page and locate the following line of code

Code: Select all

<asp:GridView ID="EmailTemplateGrid" runat="server" AllowPaging="False" AllowSorting="false"
                            AutoGenerateColumns="False" DataKeyNames="EmailTemplateId" DataSourceID="EmailTemplateDs" 
                            ShowFooter="False" SkinID="PagedList" CellPadding="4" Width="100%" OnRowCommand="EmailTemplateGrid_RowCommand">
and change it as

Code: Select all

<asp:GridView ID="EmailTemplateGrid" runat="server" AllowPaging="False" AllowSorting="true"
                            AutoGenerateColumns="False" DataKeyNames="EmailTemplateId" DataSourceID="EmailTemplateDs" 
                            ShowFooter="False" SkinID="PagedList" CellPadding="4" Width="100%" OnRowCommand="EmailTemplateGrid_RowCommand">
Now locate the

Code: Select all

<asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Left">
and make it look like

Code: Select all

<asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Left" SortExpression="Name">

User avatar
WylieE
Captain (CAPT)
Captain (CAPT)
Posts: 281
Joined: Tue Mar 25, 2008 8:26 am
Location: Puyallup, WA
Contact:

Re: Change display order of email templates

Post by WylieE » Thu Feb 19, 2009 12:05 pm

Thanks Mazar. That makes sense.

- I made the changes and am not seeing any sorting going on on the email templates page. It looks like it should be working though. ?????

Would an alternative be to sort on the Orders\SelectTemplate page?
Eric Wylie
Warmoth Guitar Products, Inc.
http://www.warmoth.com

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

Re: Change display order of email templates

Post by mazhar » Fri Feb 20, 2009 4:27 am

- I made the changes and am not seeing any sorting going on on the email templates page. It looks like it should be working though. ?????
After making the change click the Name header and it will sort the result by name

User avatar
WylieE
Captain (CAPT)
Captain (CAPT)
Posts: 281
Joined: Tue Mar 25, 2008 8:26 am
Location: Puyallup, WA
Contact:

Re: Change display order of email templates

Post by WylieE » Fri Feb 20, 2009 11:33 am

mazhar wrote:
After making the change click the Name header and it will sort the result by name
Yep. Finally clued in to that yesterday afternoon.

It would also be good for me to sort the emails on the Orders/Email/SelectTemplate page. There's no default.aspx file in that folder so I took a look at the SelectTemplate.aspx file. I don't see code resembling the changes above, but I'm wondering if I could add a sort parameter to the RadioButtonList. I'm not an ASP guy and am unfamilar with the proper syntax. Am I on the right track?
Eric Wylie
Warmoth Guitar Products, Inc.
http://www.warmoth.com

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

Re: Change display order of email templates

Post by mazhar » Fri Feb 20, 2009 11:57 am

You can edit the Admin/Order/Email/SelectTempalte.aspx file and locate the following code

Code: Select all

<asp:ObjectDataSource ID="EmailTemplateDs" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="LoadForStore" TypeName="CommerceBuilder.Messaging.EmailTemplateDataSource">
        </asp:ObjectDataSource>
and change it as below

Code: Select all

<asp:ObjectDataSource ID="EmailTemplateDs" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="LoadForStore" TypeName="CommerceBuilder.Messaging.EmailTemplateDataSource">
            <SelectParameters>
            <asp:Parameter DefaultValue="Name" Type="string" Name="sortExpression" />
            </SelectParameters>
        </asp:ObjectDataSource>

Post Reply