Print Page | Close Window

Need help with displaying Affiliate name on screen

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=2616
Printed Date: 25-July-2025 at 9:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Need help with displaying Affiliate name on screen
Posted By: Andy @ Landmarq
Subject: Need help with displaying Affiliate name on screen
Date Posted: 02-April-2009 at 8:55am
Afternoon fellow 'carters

I am trying to set up a site for use with the affiliate feature but I want the Affilate company name to display when an affilate link is clicked.

The idea being if someone just arrives on out site it's says one message but if it's an affiliate link it will add their name to the end. I have been using the code below which is a modified version of how I display a logged in customers name on the screen on my main site but having trouble pinning down the fields needed for this to work.

<% if session("IDAffiliate")<>"0" then %>
<% response.write "<h2>&nbsp;&nbsp;In partnership with Landmarq Technologies Limited & " & session("pcSFCompany") & "</h2>" %>
<% else %>
<% response.write "<h2>&nbsp;&nbsp;In partnership with Landmarq Technologies Limited</h2>" %>
 <% end if %>

The IDAffiliate should be able to pick which affiliate is being used and then the company name gets displayed but I cannot get the company name to display or get it to properly detect the difference between a regular vist and an affiliate vist.

Any help on this would be great I'm pretty sure im on the right track but it's the fields tat need tweaking.

Thanks in advance for any replies :)


-------------
Need a bespoke PC built to order? come to www.landmarq.co.uk



Replies:
Posted By: Hamish
Date Posted: 02-April-2009 at 9:08am
Hi Andy,
     You will need to get the "affiliatecompany" from the "affiliates" table of the database with some SQL. See NewAffa.asp for the code that inserts it in the table.


-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: Andy @ Landmarq
Date Posted: 02-April-2009 at 9:19am
Hi Hamish,

Thanks for the pointers :)

I thought I might but did not have much luck intially will give it another whirl, I was using newaffa.asp as a reference point to get the table names.




-------------
Need a bespoke PC built to order? come to www.landmarq.co.uk


Posted By: Andy @ Landmarq
Date Posted: 02-April-2009 at 11:44am
Being the SQL thickie that I am I have got to this, I am manually using affiliate 2 as it's a test one but I will need to find how to detect which idaffiliate is being used on the link I guess I'm still missing something as the IF statement shows the first line but the company is not being shown. Any more pointers to get me on track would be great :)

<!--#include virtual="shop/includes/opendb.asp"-->
<%
call openDB()
query="SELECT idaffiliate, affiliatecompany FROM affiliates WHERE idaffiliate=2"
set rstemp=conntemp.execute(query)
session("affid")=rstemp("idAffiliate")
Session("affcomp")=rstemp("affilatecompany")
%>
    <div id="logo">
      <h1><img src=images2/shutlogo.png></h1>
  <% if session("affid")<>"0" then %>
    <% response.write "<h2>&nbsp;&nbsp;In partnership with Landmarq Technologies Limited & " & session("affcomp") & "</h2>" %>
  <% else %>
    <% response.write "<h2>&nbsp;&nbsp;In partnership with Landmarq Technologies Limited</h2>" %>
  <% end if %>
    </div>


-------------
Need a bespoke PC built to order? come to www.landmarq.co.uk


Posted By: RUOnTheNet
Date Posted: 16-April-2009 at 12:44am
My suggestion is
 
You need to retrieve the Aff ID from the cookie on the visitor's site if product cart uses a cookie for tracking affiliates.   ( we use a third party aff program, but asp based  and that is how we do this. )
 
What you need to do is get the Aff ID from the cookie, then have it passed to your page as a string etc. ... so the idaffiliate="string_COOKIE" ..
 
 


-------------
Alan,
www.AreYouOnTheNet.com
Internet Sales, Marketing & Affiliate Program Management


Posted By: Hamish
Date Posted: 16-April-2009 at 2:50am
Hi,
   ProductCart automatically retrieves the affiliateid if there is one stored in the cookie in code within pc/pcStartSession.asp so you should be able to access it just about everywhere with: session("idAffiliate")  - basically combine your two posts. 
You should also exclude affiliateid=1
 


-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: Andy @ Landmarq
Date Posted: 21-April-2009 at 10:56am
I solved it Smile (sort of Wink)

I was not winning with the whole sql query thing (need to learn more on that front) but had a flash on inspiration that allows me a touch more flexability albeit with a touch more work.

In my header I now have

      <% if session("idAffiliate")>1 then %>
      <%
      Server.Execute("aff/"&session("idAffiliate")&".asp")
      %>
      <% else %>
        <% response.write "<h2>&nbsp;&nbsp;</h2>" %>  
  <% end if %>

(on the line with &nbsp;&nbsp; you can have a message shown when there is no affiliate set)

Then in my subdir aff/ i have files simply named 2.asp, 3.asp etc . . . which might contain

<% response.write "<h2>In partnership with XYZ Computers</h2>" %>

or

<% response.write "<h2><span style=""vertical-align: bottom;"">In partnership with&nbsp;&nbsp;<img style=""vertical-align: bottom;"" src=images/login.gif></span></h2>" %>

So when an affilate link is parsed the idaffilate becomes the filename and can display either a simple line of text or text/image or anything I fancy in the called .asp file. It work just fine and save a lot of extra database calls on every page load.

If anyone wants to use this code please feel free to help yourself Smile the only thing I found is that if you want to test different affiliates you have to clear the cookies and restart IE or clear private data and select cookies in Firefox other wise the first affiliate used will override all subsequent affiliates. There is meant to be an option in the settings to change this behaviour but could not see it on 3.51


-------------
Need a bespoke PC built to order? come to www.landmarq.co.uk



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net