Page 1 of 1

Affilite phone orders

Posted: Mon May 24, 2010 7:07 am
by ThinkNoodle
Hi
Does anyone know if there is a graceful way of attributing phone orders to an affiliate via the back end?

I don't want to have to go to the shop via an affilite link and put the order through as if I was the customer...

Thanks

Matt

Re: Affilite phone orders

Posted: Mon May 24, 2010 10:26 am
by mazhar
There isn't any thing out of the box right now for this. May be you can do some custom code to accomplish this some where in merchant side order placement procedure. Here is a suggested mod may be it workout your scenario. Edit Website/Admin/Orders/Create/CreateOrder4.aspx and locate following line

Code: Select all

<asp:ValidationSummary ID="PaymentValidationSummary" runat="server" EnableViewState="false" ValidationGroup="OPC" />

and replace it with

Code: Select all

<br />
                    <asp:Label ID="AffiliateLabel" runat="server" AssociatedControlID="Affiliate" Text="Referred By: "></asp:Label>
                    <asp:DropDownList ID="Affiliate" runat="server" AppendDataBoundItems="true" DataSourceID="AffiliateDS" DataTextField="Name" DataValueField="AffiliateId">
                        <asp:ListItem Selected="True" Value="0" Text="No Affliate"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:Label ID="ReferredDate" runat="server" Text=""></asp:Label>
                    <asp:ObjectDataSource ID="AffiliateDS" runat="server" SelectMethod="LoadForStore" TypeName="CommerceBuilder.Marketing.AffiliateDataSource" DataObjectTypeName="CommerceBuilder.Marketing.Affiliate">
                        <SelectParameters>
                            <asp:Parameter Name="sortExpression" DbType="String" DefaultValue="Name" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    <asp:ValidationSummary ID="PaymentValidationSummary" runat="server" EnableViewState="false" ValidationGroup="OPC" />
Then edit your Website/Admin/Orders/Create/CreateOrder4.aspx.cs and locate following line of code

Code: Select all

// REDIRECT TO THE FINAL ORDER
Response.Redirect("~/Admin/Orders/ViewOrder.aspx?OrderId=" + response.OrderId + "&OrderNumber=" + response.OrderNumber);
and replace it with

Code: Select all

int affiliateId = AlwaysConvert.ToInt(Affiliate.SelectedValue);
            if(affiliateId > 0)
            {
                Order order = OrderDataSource.Load(e.OrderId,false);
                order.AffiliateId = affiliateId;
                order.Save();
            }
            // REDIRECT TO THE FINAL ORDER
            Response.Redirect("~/Admin/Orders/ViewOrder.aspx?OrderId=" + response.OrderId + "&OrderNumber=" + response.OrderNumber);
Save the changes. Now try placing some order from merchant side. You will see on last screen option for affiliate selection will be available to you. If you choose some affiliate and then place order. Newly placed order will be associated to selected affiliate.

Re: Affilite phone orders

Posted: Thu May 27, 2010 5:56 am
by ThinkNoodle
Many thanks, that worked fine after one change, DbType to Type as below:

before <asp:Parameter Name="sortExpression" DbType="String" DefaultValue="Name" />

after <asp:Parameter Name="sortExpression" Type="String" DefaultValue="Name" />

Thanks again

Matt