< Day Day Up > |
Hack 75 Upsell Your Customers
Use the return variable to provide a list of items in which a customer might also be interested . Although you can use IPN to provide an order summary [Hack #74] , you're missing a sales opportunity if you don't use this page to advertise your other products, a technique known as upselling . For instance, say you're selling bicycle parts and someone comes along and buys a bottom bracket from your web site. Using this technique, your web site would then present this customer with a small ad listing some of the cranksets, pedals, and derailleurs you sell. It's easy to do, and it works better than you might expect. 7.15.1 The Return Page's JobThe return page is the page you show your customers once they are done paying for an item. To help you upsell your customers, this page has several jobs to do:
7.15.2 The CodeHere's the ASP code that does it all: <% 'Find the number of the item just purchased Dim item_number Item_number = Request.Form("item_number") %> 'Find products purchased by other buyers connStore = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ= "C:/InetPub/wwwroot/database/dbPayPal.mdb") set rsProducts = Server.CreateObject("ADODB.Recordset") rsProducts.ActiveConnection = connStore rsProducts.Source = "SELECT DISTINCT item_number FROM tblOrderDetails WHERE (payer_email IN (SELECT payer_email FROM tblOrderDetails WHERE (txtItemNumber = 'item_number')))" rsProducts.Open( ) %> <% If Not rsProducts.EOF Or Not rsProducts.BOF Then 'it exists %> <% 'While recordset still has products, loop code While NOT rsProducts.EOF %> <a href="http://yoursite.com/product_detail.asp?item_number=<%=rsProducts ("item_number)%">Link Text Here</a><br> <% 'Move to next record rsProducts.MoveNext( ) Wend %> <% End If %>
7.15.3 Running the CodeSimply save this file in a public folder on your web server, and then set your return page to the URL of the page [Hack #85] . When a customer pays, this code looks up the product that was just purchased and uses a SQL statement to look up past purchases of this product to see what other products those customers purchased along with it. |
< Day Day Up > |