NB Store with affiliate tracking software, IDevAffiliate

Dec 11, 2009 at 3:51 PM


Here's my question - our customer has been happily using NB Store for many months.  She has recently purchased web-based software that promises to track "affiliate" purchases from her store (for calculating commissions for consultants who have that customer).  The software company is IDevAffiliate, http://www.idevdirect.com.

She has asked me to set up the integration between her NB Store cart (with PayPal, perhaps) and this separate affiliate software.

IDevAffiliate supposedly works with PayPal payment systems, and only requires that I add a "tracking pixel" to a standard asp.net .aspx page with the "Buy Now" PayPal button - here are the two lines they say I need to add to an .aspx page make their software work:

<input type="hidden" name="notify_url" value="http://www.settoateaaffiliates.com/paypal_ipn_buynow.php">
<input type="hidden" name="custom" value="<%=Request.ServerVariables("REMOTE_ADDR")%>">

My question - is there a way to add these lines to the NB Store application?  I'm not at all familiar with how NB Store is interfacing with PayPal, but while looking through the source code, I found this in the  GatewayPayPal.vb page, below, from the sub "SetBankRemotePost" - looks as if you are setting the PayPal parameters there.

Can I integrate the IDevAffiliate hidden input parameters here?  Can I modify NB Store's "notify URL" parameter for use with the IDevAffililate software?  Is there a better approach that you would recommend?

Public Overrides Sub SetBankRemotePost(ByVal PortalID As Integer, ByVal OrderID As Integer, ByVal Lang As String, ByVal Request As System.Web.HttpRequest)

            Dim RPost As New RemotePost

            'test if Paypal button has been clicked
            If Not Request.Form.Item("PAYPAL.x") Is Nothing Then
                Dim objSCtrl As New SettingsController
                Dim objSInfo As NB_Store_SettingsInfo
                objSInfo = objSCtrl.GetSetting(PortalID, "PayPal.gateway", "None")
                If Not objSInfo Is Nothing Then

                    Dim setParams As Hashtable = createSettingsTable(objSInfo.SettingValue)

                    Dim returnURL As String = setParams("ReturnURL")
                    Dim cancelURL As String = setParams("ReturnCancelURL")
                    Dim notifyURL As String = setParams("ReturnNotifyURL")

                    Dim payPalURL As String = setParams("paymentURL")

                    Dim PayPalID As String = setParams("PayPalID")
                    Dim PayPalCartName As String = setParams("CartName")
                    Dim PayPalButtonURL As String = setParams("ButtonImageURL")
                    Dim PayPalCurrency As String = setParams("Currency")
                    Dim PayPalMerchantLanguage As String = setParams("MerchantLanguage")

                    Dim objOCtrl As New OrderController
                    Dim oInfo As NB_Store_OrdersInfo = objOCtrl.GetOrder(OrderID)

                    If Not oInfo Is Nothing Then

                        returnURL = Replace(returnURL, "[ORDERID]", oInfo.OrderID.ToString)
                        cancelURL = Replace(cancelURL, "[ORDERID]", oInfo.OrderID.ToString)
                        notifyURL = Replace(notifyURL, "[ORDERID]", oInfo.OrderID.ToString)
                        PayPalCartName = Replace(PayPalCartName, "[CARTID]", CurrentCart.GetCurrentCart(PortalID).CartID)

                        payPalURL += "?business=" & HTTPPOSTEncode(PayPalID)
                        payPalURL += "&item_name=" & HTTPPOSTEncode(PayPalCartName)
                        payPalURL += "&item_number=" & HTTPPOSTEncode(oInfo.OrderID.ToString)
                        payPalURL += "&quantity=1"
                        payPalURL += "&custom=" & GetCurrentCulture()
                        payPalURL += "&amount=" & HTTPPOSTEncode(Replace(oInfo.CartTotal.ToString("0.00"), ",", "."))
                        payPalURL += "&shipping=" & HTTPPOSTEncode(Replace(oInfo.ShippingCost.ToString("0.00"), ",", "."))
                        payPalURL += "&tax=" & HTTPPOSTEncode(Replace(oInfo.AppliedTax.ToString("0.00"), ",", "."))
                        payPalURL += "&currency_code=" & HTTPPOSTEncode(PayPalCurrency)
                        payPalURL += "&bn=" & HTTPPOSTEncode("NB_Store")
                        payPalURL += "&return=" & HTTPPOSTEncode(returnURL)
                        payPalURL += "&cancel_return=" & HTTPPOSTEncode(cancelURL)
                        payPalURL += "&notify_url=" & HTTPPOSTEncode(notifyURL)
                        payPalURL += "&undefined_quantity=0&no_note=1&no_shipping=1"

Thank you so much for any help you can provide!


Dec 14, 2009 at 8:25 PM

Hi Lisa,

with the new paypal provider you can add you own url parameters, look at the readme.txt included with the provider install package.

Although looking at your example, it looks like your redirecting the IPN to the affiliates tracking...I presumme from there the notify is also sent back to the store, otherwise your IPN won;t operator in the store.