track AFID in admin CreateOrder process

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sfeher
Captain (CAPT)
Captain (CAPT)
Posts: 220
Joined: Fri Jun 04, 2004 1:58 pm
Location: Steubenville, Ohio

track AFID in admin CreateOrder process

Post by sfeher » Wed Dec 21, 2011 9:50 am

We're using AbleCRM in addition to our AC 7.0.7 store. Sales staff are setup as "Affiliates" so that we can track all sales and pay commissions accordingly.

At present, sales staff login through AbleCRM to find/locate a customer and then create an order from the interface.
This leverages the Admin 'Create Order' process at http://www.domain.com/Admin/Orders/Crea ... rder1.aspx

is there a way to append the AFID to this CreateOrder1.aspx page so that we can correctly track orders from affiliates?
As I look through the comments and board posts, I see no reference to using the afid URL query except on the Default.aspx page.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: track AFID in admin CreateOrder process

Post by david-ebt » Wed Dec 21, 2011 1:55 pm

Do you mind having the sales staff enter their affiliate number for each order they create in the admin? If that works, you can make a couple of simple modifications to the Admin/Orders/Create/CreateOrder4 pages to accomplish this.

In Admin/Orders/Create/CreateOrder4.aspx, add this under the CouponDialog entry. You can move this around the page, but this is where they will enter their sales/affiliate ID.

Code: Select all

<uc:CouponDialog ID="CouponDialog1" runat="server" />
<div class="section">
    <div class="header">
        <h2 class="commonicon"><asp:Localize ID="AffiliateCaption" runat="server" Text="Affiliate Code" EnableViewState="false"></asp:Localize></h2>
    </div>
    <asp:Panel ID="AffilliateCodePanel" runat="server" CssClass="content">
        <asp:TextBox ID="AffilliateTextBox" runat="server" Width="110px" MaxLength="100" EnableViewState="false"></asp:TextBox>
    </asp:Panel>
</div>
Then modify the CheckOut function inside Admin/Orders/Create/CreateOrder4.aspx.cs by adding this code just before the redirect to the VIewOrder page:

Code: Select all

Order orderPlaced = OrderDataSource.Load(response.OrderId);
if (orderPlaced != null && !string.IsNullOrEmpty(AffilliateTextBox.Text))
{
    Affiliate salesAffiliate = AffiliateDataSource.Load(Convert.ToInt32(AffilliateTextBox.Text));
    if (salesAffiliate != null)
    {
        orderPlaced.AffiliateId = salesAffiliate.AffiliateId;
        orderPlaced.Save();
    }
}

// REDIRECT TO THE FINAL ORDER
Response.Redirect("~/Admin/Orders/ViewOrder.aspx?OrderId=" + response.OrderId + "&OrderNumber=" + response.OrderNumber);
If you want to keep the affiliate ID so the sales staff don't have to enter it, you'll have to see if the affiliateID can be passed around on the admin site without getting lost.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

sfeher
Captain (CAPT)
Captain (CAPT)
Posts: 220
Joined: Fri Jun 04, 2004 1:58 pm
Location: Steubenville, Ohio

Re: track AFID in admin CreateOrder process

Post by sfeher » Wed Dec 21, 2011 2:20 pm

As I was thinking through this process today, I thought about appending the Order4 page to include this. I was originally thinking about appending this into the front end with the URL string to include the afid into the string, but, as you mentioned, it seems like the affiliate ID gets lost inside the admin site.

I didn't get as far as you did here with the code above, but I'll give this some thought and see how it turns out.

Thanks for the input!

Steve

Post Reply